From 8e5a0dcf272dda711449a31746f602d5a72c81f1 Mon Sep 17 00:00:00 2001 From: Dmitrii Stepanov Date: Mon, 3 Apr 2023 19:15:13 +0300 Subject: [PATCH] [#204] gc: Fix GC handlers start Signed-off-by: Dmitrii Stepanov --- pkg/local_object_storage/shard/gc.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/local_object_storage/shard/gc.go b/pkg/local_object_storage/shard/gc.go index c3bb841d..6f18e6c3 100644 --- a/pkg/local_object_storage/shard/gc.go +++ b/pkg/local_object_storage/shard/gc.go @@ -136,7 +136,8 @@ func (gc *gc) listenEvents(ctx context.Context) { v.cancelFunc() v.prevGroup.Wait() - ctx, v.cancelFunc = context.WithCancel(ctx) + var runCtx context.Context + runCtx, v.cancelFunc = context.WithCancel(ctx) v.prevGroup.Add(len(v.handlers)) @@ -144,7 +145,7 @@ func (gc *gc) listenEvents(ctx context.Context) { h := v.handlers[i] err := gc.workerPool.Submit(func() { - h(ctx, event) + h(runCtx, event) v.prevGroup.Done() }) if err != nil {