Fixup err nil checks

Cleanup double `if` statements for errors being nil / not-nil.

Signed-off-by: SuperQ <superq@gmail.com>
This commit is contained in:
SuperQ 2025-08-25 17:37:02 +02:00
parent 7cf585527f
commit b87cbf0294
No known key found for this signature in database
GPG Key ID: C646B23C9E3245F1
2 changed files with 2 additions and 5 deletions

View File

@ -704,8 +704,7 @@ func (h *Head) Init(minValidTime int64) error {
snapshotLoaded = true
chunkSnapshotLoadDuration = time.Since(start)
h.logger.Info("Chunk snapshot loading time", "duration", chunkSnapshotLoadDuration.String())
}
if err != nil {
} else {
snapIdx, snapOffset = -1, 0
refSeries = make(map[chunks.HeadSeriesRef]*memSeries)

View File

@ -1443,12 +1443,10 @@ func (h *Head) performChunkSnapshot() error {
startTime := time.Now()
stats, err := h.ChunkSnapshot()
elapsed := time.Since(startTime)
if err == nil {
h.logger.Info("chunk snapshot complete", "duration", elapsed.String(), "num_series", stats.TotalSeries, "dir", stats.Dir)
}
if err != nil {
return fmt.Errorf("chunk snapshot: %w", err)
}
h.logger.Info("chunk snapshot complete", "duration", elapsed.String(), "num_series", stats.TotalSeries, "dir", stats.Dir)
return nil
}