Exit on the first error encountered
houbaron opened this issue · comments
houbaron commented
When we run batch tasks, sometimes an error in one subtask means that the whole task is wrong. So it is desirable to add the ability to exit on the first error encountered.
Camden Cheek commented
Would (*ContextPool).CancelOnError()
work for your use case? When a task returns an error, the context is canceled, signaling to your tasks that they should exit.
I'm hesitant to break the current guarantee that "all tasks spawned with Go()
will be run to completion." I'd prefer to leave the definition of "completion" to the user.