Fix concurrent access on task returnError

This commit is contained in:
世界 2023-09-30 21:37:12 +08:00
parent 63b82af61f
commit e727641a98
No known key found for this signature in database
GPG key ID: CD109927C34A63C4

View file

@ -87,16 +87,18 @@ func (g *Group) RunContextList(contextList []context.Context) error {
}
selectedContext, upstreamErr := common.SelectContext(append([]context.Context{taskCancelContext}, contextList...))
if selectedContext != 0 {
returnError = E.Append(returnError, upstreamErr, func(err error) error {
return E.Cause(err, "upstream")
})
}
if g.cleanup != nil {
g.cleanup()
}
<-taskContext.Done()
if selectedContext != 0 {
returnError = E.Append(returnError, upstreamErr, func(err error) error {
return E.Cause(err, "upstream")
})
}
return returnError
}