Skip to content

Commit

Permalink
fix defer cancel warning in for loop
Browse files Browse the repository at this point in the history
  • Loading branch information
felixhao committed Apr 30, 2019
1 parent 1c4d13d commit 202a1e2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ func main() {
switch s {
case syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT:
ctx, cancel := context.WithTimeout(context.Background(), 35*time.Second)
defer cancel()
grpcSrv.Shutdown(ctx)
httpSrv.Shutdown(ctx)
log.Info("kratos-demo exit")
svc.Close()
cancel()
time.Sleep(time.Second)
return
case syscall.SIGHUP:
Expand Down

0 comments on commit 202a1e2

Please sign in to comment.