Skip to content

Commit

Permalink
Use HTTP request's context, so cancellation works. (#510)
Browse files Browse the repository at this point in the history
Signed-off-by: Brian Brazil <[email protected]>
  • Loading branch information
brian-brazil authored Aug 16, 2019
1 parent 4bf1892 commit 64308dd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func probeHandler(w http.ResponseWriter, r *http.Request, c *config.Config, logg
return
}

ctx, cancel := context.WithTimeout(context.Background(), time.Duration(timeoutSeconds*float64(time.Second)))
ctx, cancel := context.WithTimeout(r.Context(), time.Duration(timeoutSeconds*float64(time.Second)))
defer cancel()
r = r.WithContext(ctx)

Expand Down

0 comments on commit 64308dd

Please sign in to comment.