Skip to content
This repository has been archived by the owner on Jan 12, 2023. It is now read-only.

Commit

Permalink
Make sure we return noFlush on an empty series
Browse files Browse the repository at this point in the history
Signed-off-by: Bryan Boreham <bryan@weave.works>
  • Loading branch information
bboreham committed Jan 22, 2020
1 parent ab3e836 commit 17c0c21
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pkg/ingester/flush.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,9 @@ func (i *Ingester) sweepSeries(userID string, fp model.Fingerprint, series *memo
}

func (i *Ingester) shouldFlushSeries(series *memorySeries, fp model.Fingerprint, immediate bool) flushReason {
if len(series.chunkDescs) == 0 {
return noFlush
}
if immediate {
return reasonImmediate
}
Expand All @@ -203,12 +206,9 @@ func (i *Ingester) shouldFlushSeries(series *memorySeries, fp model.Fingerprint,
return series.chunkDescs[0].flushReason
}
return reasonMultipleChunksInSeries
} else if len(series.chunkDescs) > 0 {
// Otherwise look in more detail at the first chunk
return i.shouldFlushChunk(series.chunkDescs[0], fp, series.isStale())
}

return noFlush
// Otherwise look in more detail at the first chunk
return i.shouldFlushChunk(series.chunkDescs[0], fp, series.isStale())
}

func (i *Ingester) shouldFlushChunk(c *desc, fp model.Fingerprint, lastValueIsStale bool) flushReason {
Expand Down

0 comments on commit 17c0c21

Please sign in to comment.