Skip to content

Commit

Permalink
Handle cancel function in metrics server shutdown
Browse files Browse the repository at this point in the history
  • Loading branch information
gdiazlo committed Apr 10, 2019
1 parent 87a9b0f commit a089e95
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ func (m Server) Start() {
// Shutdown gracefully shutdowns metrics http server waiting 5 seconds for
// connections to be closed.
func (m Server) Shutdown() {
ctx, _ := context.WithTimeout(context.Background(), 5*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
m.server.Shutdown(ctx)
}

Expand Down

0 comments on commit a089e95

Please sign in to comment.