Move check for empty memory series to separate method.

This commit is contained in:
Julius Volz 2013-06-19 14:19:53 +02:00
parent 16364eda37
commit 008bc09da8

View file

@ -141,6 +141,10 @@ func (s *stream) getRangeValues(in model.Interval) model.Values {
return result return result
} }
func (s *stream) empty() bool {
return len(s.values) == 0
}
func newStream(metric model.Metric) *stream { func newStream(metric model.Metric) *stream {
return &stream{ return &stream{
metric: metric, metric: metric,
@ -258,7 +262,7 @@ func (s *memorySeriesStorage) Flush(flushOlderThan time.Time, queue chan<- model
s.Lock() s.Lock()
for _, fingerprint := range emptySeries { for _, fingerprint := range emptySeries {
if len(s.fingerprintToSeries[fingerprint].values) == 0 { if s.fingerprintToSeries[fingerprint].empty() {
s.dropSeries(&fingerprint) s.dropSeries(&fingerprint)
} }
} }