Fix task cancel

This commit is contained in:
世界 2022-07-14 20:19:43 +08:00
parent 51de48ed21
commit f8c0f71a89
No known key found for this signature in database
GPG key ID: CD109927C34A63C4

View file

@ -27,9 +27,9 @@ func Run(ctx context.Context, tasks ...func() error) error {
}()
select {
case <-ctx.Done():
retErr = append(retErr, ctx.Err())
case <-runtimeCtx.Done():
}
retErr = append(retErr, ctx.Err())
return E.Errors(retErr...)
}
@ -48,8 +48,7 @@ func Any(ctx context.Context, tasks ...func(ctx context.Context) error) error {
}
select {
case <-ctx.Done():
return ctx.Err()
case <-runtimeCtx.Done():
return retErr
}
return E.Errors(retErr, ctx.Err())
}