[#378] shard/gc: Avoid usage of the range-loop vars in go-routines

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2021-02-19 11:14:51 +03:00 committed by Alex Vanin
parent b644589bb4
commit ff442e9559

View file

@ -123,7 +123,9 @@ func (gc *gc) listenEvents() {
v.prevGroup.Add(len(v.handlers))
for _, h := range v.handlers {
for i := range v.handlers {
h := v.handlers[i]
err := gc.workerPool.Submit(func() {
h(ctx, event)
v.prevGroup.Done()