diff --git a/api/server/handlers/release/update_image_batch.go b/api/server/handlers/release/update_image_batch.go index c51c8fe0bc..abaa6f4f70 100644 --- a/api/server/handlers/release/update_image_batch.go +++ b/api/server/handlers/release/update_image_batch.go @@ -90,10 +90,9 @@ func (c *UpdateImageBatchHandler) ServeHTTP(w http.ResponseWriter, r *http.Reque errs := make([]string, 0) for i := range namespaceScopedReleases { - index := i wg.Add(1) - go func() { + go func(index int) { ctx, span := telemetry.NewSpan(ctx, "update-image-batch") defer span.End() defer wg.Done() @@ -142,7 +141,7 @@ func (c *UpdateImageBatchHandler) ServeHTTP(w http.ResponseWriter, r *http.Reque mu.Unlock() } } - }() + }(i) } wg.Wait()