explicitly pass context

This commit is contained in:
Andre Medeiros 2022-10-31 21:49:34 -04:00
parent d9f7689d27
commit f01d305c57

View file

@ -494,7 +494,7 @@ func enqueueAccounts(ctx context.Context, logger *zap.Logger, statsd *statsd.Cli
wg := sync.WaitGroup{} wg := sync.WaitGroup{}
for i := 0; i < len(ids); i += batchSize { for i := 0; i < len(ids); i += batchSize {
wg.Add(1) wg.Add(1)
go func(offset int) { go func(offset int, ctx context.Context) {
defer wg.Done() defer wg.Done()
ctx, cancel := context.WithCancel(ctx) ctx, cancel := context.WithCancel(ctx)
@ -523,7 +523,7 @@ func enqueueAccounts(ctx context.Context, logger *zap.Logger, statsd *statsd.Cli
if err = queue.Publish(unlocked...); err != nil { if err = queue.Publish(unlocked...); err != nil {
logger.Error("failed to enqueue account batch", zap.Error(err)) logger.Error("failed to enqueue account batch", zap.Error(err))
} }
}(i) }(i, ctx)
} }
wg.Wait() wg.Wait()