mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-26 22:19:40 -08:00
Drain the newBaseLabels channel upon shutdown.
This should help cut down shutdown times. Change-Id: I6e70a598a9e49aa6eeeb2034105b1bc6e9014324
This commit is contained in:
parent
3f61d304ce
commit
92156ee89d
|
@ -207,6 +207,18 @@ func (t *target) recordScrapeHealth(ingester extraction.Ingester, timestamp clie
|
||||||
|
|
||||||
// RunScraper implements Target.
|
// RunScraper implements Target.
|
||||||
func (t *target) RunScraper(ingester extraction.Ingester, interval time.Duration) {
|
func (t *target) RunScraper(ingester extraction.Ingester, interval time.Duration) {
|
||||||
|
defer func() {
|
||||||
|
// Need to drain t.newBaseLabels to not make senders block during shutdown.
|
||||||
|
for {
|
||||||
|
select {
|
||||||
|
case <-t.newBaseLabels:
|
||||||
|
// Do nothing.
|
||||||
|
default:
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
jitterTimer := time.NewTimer(time.Duration(float64(interval) * rand.Float64()))
|
jitterTimer := time.NewTimer(time.Duration(float64(interval) * rand.Float64()))
|
||||||
select {
|
select {
|
||||||
case <-jitterTimer.C:
|
case <-jitterTimer.C:
|
||||||
|
|
Loading…
Reference in a new issue