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,20 +467,19 @@ func (s *memorySeriesStorage) handleEvictList() {
s.maybeEvict() s.maybeEvict()
} }
case <-s.evictStopping: case <-s.evictStopping:
// Drain evictRequests to not let requesters hang. // Drain evictRequests forever in a goroutine to not let
// requesters hang.
go func() {
for { for {
select { <-s.evictRequests
case <-s.evictRequests: }
// Do nothing. }()
default:
ticker.Stop() ticker.Stop()
glog.Info("Chunk eviction stopped.") glog.Info("Chunk eviction stopped.")
close(s.evictStopped) close(s.evictStopped)
return return
} }
} }
}
}
} }
// maybeEvict is a local helper method. Must only be called by handleEvictList. // maybeEvict is a local helper method. Must only be called by handleEvictList.