diff options
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/server.go | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/examples/server.go b/examples/server.go index 2f6ac88..29d5bf1 100644 --- a/examples/server.go +++ b/examples/server.go @@ -48,7 +48,8 @@ func main() { case <-c: // Shutdown the server log.Println("Shutting down...") - ctx, _ := context.WithTimeout(context.Background(), 30*time.Second) + ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) + defer cancel() err := server.Shutdown(ctx) if err != nil { log.Fatal(err) |