projects
/
blackbox_exporter.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
4bf1892
)
Use HTTP request's context, so cancellation works. (#510)
author
Brian Brazil
<brian.brazil@robustperception.io>
Fri, 16 Aug 2019 12:58:30 +0000
(13:58 +0100)
committer
GitHub
<noreply@github.com>
Fri, 16 Aug 2019 12:58:30 +0000
(13:58 +0100)
Signed-off-by: Brian Brazil <brian.brazil@robustperception.io>
main.go
patch
|
blob
|
blame
|
history
diff --git
a/main.go
b/main.go
index 509e62ed14b8ed1ffdb1508d806a6e59738f27e8..e4f9b75f400f6fbafc0b33bd6886f9bd8395525a 100644
(file)
--- 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)