mirror of
https://github.com/prometheus/prometheus
synced 2024-12-26 00:23:18 +00:00
Merge pull request #2710 from prometheus/fabxc-patch-1
retrieval: add missing scrape context cancelation
This commit is contained in:
commit
8e73bde650
@ -469,9 +469,9 @@ func (sl *scrapeLoop) run(interval, timeout time.Duration, errc chan<- error) {
|
||||
}
|
||||
|
||||
var (
|
||||
total, added int
|
||||
start = time.Now()
|
||||
scrapeCtx, _ = context.WithTimeout(sl.ctx, timeout)
|
||||
total, added int
|
||||
start = time.Now()
|
||||
scrapeCtx, cancel = context.WithTimeout(sl.ctx, timeout)
|
||||
)
|
||||
|
||||
// Only record after the first scrape.
|
||||
@ -482,6 +482,7 @@ func (sl *scrapeLoop) run(interval, timeout time.Duration, errc chan<- error) {
|
||||
}
|
||||
|
||||
err := sl.scraper.scrape(scrapeCtx, buf)
|
||||
cancel()
|
||||
if err == nil {
|
||||
b := buf.Bytes()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user