Browse Source

retrieval: fix missing scrape context cancellation (#2599)

pull/2712/head
Julius Volz 8 years ago committed by GitHub
parent
commit
f160f17a6f
  1. 3
      retrieval/scrape.go

3
retrieval/scrape.go

@ -413,7 +413,7 @@ func (sl *scrapeLoop) run(interval, timeout time.Duration, errc chan<- error) {
if !sl.appender.NeedsThrottling() {
var (
start = time.Now()
scrapeCtx, _ = context.WithTimeout(sl.ctx, timeout)
scrapeCtx, cancel = context.WithTimeout(sl.ctx, timeout)
numPostRelabelSamples = 0
)
@ -425,6 +425,7 @@ func (sl *scrapeLoop) run(interval, timeout time.Duration, errc chan<- error) {
}
samples, err := sl.scraper.scrape(scrapeCtx, start)
cancel()
if err == nil {
numPostRelabelSamples, err = sl.append(samples)
}

Loading…
Cancel
Save