fix(wallet)_: pass loop var by value to goroutine (#5710)
This commit is contained in:
parent
1287e5af14
commit
f837bb55c4
|
@ -193,9 +193,9 @@ func (s *Scheduler) Stop() {
|
||||||
for pair := s.queue.Oldest(); pair != nil; pair = pair.Next() {
|
for pair := s.queue.Oldest(); pair != nil; pair = pair.Next() {
|
||||||
// Notify the queued one that they are canceled
|
// Notify the queued one that they are canceled
|
||||||
if pair.Value.policy == ReplacementPolicyCancelOld {
|
if pair.Value.policy == ReplacementPolicyCancelOld {
|
||||||
go func() {
|
go func(val *taskContext) {
|
||||||
pair.Value.resFn(nil, pair.Value.taskType, context.Canceled)
|
val.resFn(nil, val.taskType, context.Canceled)
|
||||||
}()
|
}(pair.Value)
|
||||||
}
|
}
|
||||||
s.queue.Delete(pair.Value.taskType)
|
s.queue.Delete(pair.Value.taskType)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue