From 8b7cb587c5d592613283f064c5803db4fb6d6b6e Mon Sep 17 00:00:00 2001 From: Jan Eitzinger Date: Thu, 19 Feb 2026 09:01:54 +0100 Subject: [PATCH] Modernize code --- pkg/metricstore/checkpoint.go | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/pkg/metricstore/checkpoint.go b/pkg/metricstore/checkpoint.go index cf28e12e..2423a463 100644 --- a/pkg/metricstore/checkpoint.go +++ b/pkg/metricstore/checkpoint.go @@ -98,9 +98,7 @@ func Checkpointing(wg *sync.WaitGroup, ctx context.Context) { if Keys.Checkpoints.FileFormat == "json" { ms := GetMemoryStore() - wg.Add(1) - go func() { - defer wg.Done() + wg.Go(func() { d, err := time.ParseDuration(Keys.Checkpoints.Interval) if err != nil { cclog.Fatalf("[METRICSTORE]> invalid checkpoint interval '%s': %s", Keys.Checkpoints.Interval, err.Error()) @@ -136,12 +134,9 @@ func Checkpointing(wg *sync.WaitGroup, ctx context.Context) { } } } - }() + }) } else { - wg.Add(1) - go func() { - defer wg.Done() - + wg.Go(func() { select { case <-ctx.Done(): return @@ -160,7 +155,7 @@ func Checkpointing(wg *sync.WaitGroup, ctx context.Context) { GetAvroStore().ToCheckpoint(Keys.Checkpoints.RootDir, false) } } - }() + }) } }