From d243cebab616a493d75e11249b286792d6cc95b6 Mon Sep 17 00:00:00 2001 From: Andre Medeiros Date: Sat, 4 Jun 2022 10:24:22 -0400 Subject: [PATCH] better iteration --- internal/cmd/scheduler.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/internal/cmd/scheduler.go b/internal/cmd/scheduler.go index bf256ee..cfebee4 100644 --- a/internal/cmd/scheduler.go +++ b/internal/cmd/scheduler.go @@ -442,12 +442,10 @@ func enqueueAccounts(ctx context.Context, logger *zap.Logger, statsd *statsd.Cli logger.Debug("enqueueing account batch", zap.Int("count", len(ids)), zap.Time("start", now)) - batches := (idslen / batchSize) + 1 - wg := sync.WaitGroup{} - wg.Add(batches) - // Split ids in batches + wg := sync.WaitGroup{} for i := 0; i < idslen; i += batchSize { + wg.Add(1) go func(offset int) { defer wg.Done()