How to cancel all remaining tasks in gather if one fails?
The problem with your implementation is that it calls sleepers.cancel() after sleepers has already raised. Technically the future returned by gather() is in a completed state, so its cancellation must be no-op. To correct the code, you just need to cancel the children yourself instead of trusting gather‘s future to do it. Of course, coroutines … Read more