From 64308dde3a90b580b1d9102a390cd737b694cb63 Mon Sep 17 00:00:00 2001 From: Brian Brazil Date: Fri, 16 Aug 2019 13:58:30 +0100 Subject: [PATCH] Use HTTP request's context, so cancellation works. (#510) Signed-off-by: Brian Brazil --- main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.go b/main.go index 509e62e..e4f9b75 100644 --- a/main.go +++ b/main.go @@ -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) -- 2.25.1