Merge pull request #459 from prometheus/beorn7/fix-deadlock

Remove a deadlock during shutdown.
This commit is contained in:
Björn Rabenstein 2015-01-22 15:10:08 +01:00
commit f541390dfb

View File

@ -467,18 +467,17 @@ func (s *memorySeriesStorage) handleEvictList() {
s.maybeEvict()
}
case <-s.evictStopping:
// 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
// Drain evictRequests forever in a goroutine to not let
// requesters hang.
go func() {
for {
<-s.evictRequests
}
}
}()
ticker.Stop()
glog.Info("Chunk eviction stopped.")
close(s.evictStopped)
return
}
}
}