From d9f7689d27c8cd44dd76bb3c05826e5d1ef403a6 Mon Sep 17 00:00:00 2001 From: Andre Medeiros Date: Mon, 31 Oct 2022 21:48:47 -0400 Subject: [PATCH] one context per goroutine --- internal/cmd/scheduler.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/cmd/scheduler.go b/internal/cmd/scheduler.go index 17a3d7a..c71efc2 100644 --- a/internal/cmd/scheduler.go +++ b/internal/cmd/scheduler.go @@ -497,6 +497,9 @@ func enqueueAccounts(ctx context.Context, logger *zap.Logger, statsd *statsd.Cli go func(offset int) { defer wg.Done() + ctx, cancel := context.WithCancel(ctx) + defer cancel() + j := offset + batchSize if j > len(ids) { j = len(ids)