Browse Source

fix defer not called

master^2
Justin Duch 11 months ago
parent
commit
44422b8a22
  1. 4
      main.go

4
main.go

@ -59,7 +59,9 @@ func main() {
<-stop
fmt.Println("\nShutting down the server...")
ctx, _ := context.WithTimeout(context.Background(), 10*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
s.Shutdown(ctx)
fmt.Println("Server stopped")
}

Loading…
Cancel
Save