[#204] gc: Fix GC handlers start

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
Dmitrii Stepanov 2023-04-03 19:15:13 +03:00
parent a69c6d1ec9
commit 55ef1f8a9b

View file

@ -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 {