Add another check for stopped scraper.
This commit is contained in:
parent
5678a86924
commit
16a1a6d324
|
@ -277,6 +277,13 @@ func (t *target) RunScraper(ingester extraction.Ingester, interval time.Duration
|
||||||
// actual scrape interval increase as long as a scrape takes
|
// actual scrape interval increase as long as a scrape takes
|
||||||
// longer than the interval we are aiming for.
|
// longer than the interval we are aiming for.
|
||||||
time.Sleep(took - interval)
|
time.Sleep(took - interval)
|
||||||
|
// After the sleep, we should check again if we have been stopped.
|
||||||
|
select {
|
||||||
|
case <-t.scraperStopping:
|
||||||
|
return
|
||||||
|
default:
|
||||||
|
// Do nothing.
|
||||||
|
}
|
||||||
t.scrape(ingester)
|
t.scrape(ingester)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue