From dbc22b972ce8d2d6c12a9c8e6a43004bdeefc943 Mon Sep 17 00:00:00 2001 From: beorn7 Date: Thu, 26 Feb 2015 23:40:35 +0100 Subject: [PATCH] Check last time in head chunk for head chunk timeout, not first. --- storage/local/storage.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage/local/storage.go b/storage/local/storage.go index 916da11390..b9955f0080 100644 --- a/storage/local/storage.go +++ b/storage/local/storage.go @@ -915,7 +915,7 @@ func (s *memorySeriesStorage) maintainMemorySeries(fp clientmodel.Fingerprint, b // If we are here, the series is not archived, so check for chunkDesc // eviction next and then if the head chunk needs to be persisted. series.evictChunkDescs(iOldestNotEvicted) - if !series.headChunkPersisted && time.Now().Sub(series.head().firstTime().Time()) > headChunkTimeout { + if !series.headChunkPersisted && time.Now().Sub(series.head().lastTime().Time()) > headChunkTimeout { series.headChunkPersisted = true // Since we cannot modify the head chunk from now on, we // don't need to bother with cloning anymore.