mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-26 06:04:05 -08:00
Remove a deadlock during shutdown.
This commit is contained in:
parent
917acb6baf
commit
eb932d1524
|
@ -424,7 +424,7 @@ func (s *memorySeriesStorage) preloadChunksForRange(
|
||||||
func (s *memorySeriesStorage) handleEvictList() {
|
func (s *memorySeriesStorage) handleEvictList() {
|
||||||
ticker := time.NewTicker(maxEvictInterval)
|
ticker := time.NewTicker(maxEvictInterval)
|
||||||
count := 0
|
count := 0
|
||||||
loop:
|
|
||||||
for {
|
for {
|
||||||
// To batch up evictions a bit, this tries evictions at least
|
// To batch up evictions a bit, this tries evictions at least
|
||||||
// once per evict interval, but earlier if the number of evict
|
// once per evict interval, but earlier if the number of evict
|
||||||
|
@ -450,12 +450,20 @@ loop:
|
||||||
s.maybeEvict()
|
s.maybeEvict()
|
||||||
}
|
}
|
||||||
case <-s.evictStopping:
|
case <-s.evictStopping:
|
||||||
break loop
|
// Drain evictRequests to not let requesters hang.
|
||||||
|
for {
|
||||||
|
select {
|
||||||
|
case <-s.evictRequests:
|
||||||
|
// Do nothing.
|
||||||
|
default:
|
||||||
|
ticker.Stop()
|
||||||
|
glog.Info("Chunk eviction stopped.")
|
||||||
|
close(s.evictStopped)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ticker.Stop()
|
|
||||||
glog.Info("Chunk eviction stopped.")
|
|
||||||
close(s.evictStopped)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// maybeEvict is a local helper method. Must only be called by handleEvictList.
|
// maybeEvict is a local helper method. Must only be called by handleEvictList.
|
||||||
|
|
Loading…
Reference in a new issue