fix(wallet)_: pass loop var by value to goroutine (#5710) (#5722)

Co-authored-by: Icaro Motta <icaro.ldm@gmail.com>
This commit is contained in:
Jamie Caprani 2024-08-15 13:46:36 +01:00 committed by GitHub
parent 5bb7c6a8f3
commit dd787c982a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 3 deletions

View File

@ -193,9 +193,9 @@ func (s *Scheduler) Stop() {
for pair := s.queue.Oldest(); pair != nil; pair = pair.Next() {
// Notify the queued one that they are canceled
if pair.Value.policy == ReplacementPolicyCancelOld {
go func() {
pair.Value.resFn(nil, pair.Value.taskType, context.Canceled)
}()
go func(val *taskContext) {
val.resFn(nil, val.taskType, context.Canceled)
}(pair.Value)
}
s.queue.Delete(pair.Value.taskType)
}