Closed cstruct closed 3 years ago
Thanks a lot for creating this PR @cstruct :)
Would you mind applying the following change instead ?
diff --git a/aiostream/manager.py b/aiostream/manager.py
index bc73de8..e39d70f 100644
--- a/aiostream/manager.py
+++ b/aiostream/manager.py
@@ -48,6 +48,8 @@ class TaskGroup:
# This makes sense since we don't know in which context the exception
# was meant to be processed. For instance, a `StopAsyncIteration`
# might be raised to notify that the end of a streamer has been reached.
+ if not task.cancelled():
+ task.exception()
self._pending.discard(task)
This way the discarding of the exception follows the corresponding comment. Also, task.exception()
raises a CancelledError
if the task was cancelled, which is not what we want here.
Fixed.
Also, task.exception() raises a CancelledError if the task was cancelled, which is not what we want here.
I don't think this was the case since the task wasn't canceled yet, either way this is a lot clearer :+1:
Updated commit message since the old one did not make sense anymore
Cancelling failed tasks makes sure we do not get
Task exception was never retrieved
if two tasks fail in the same tick.This fixes vxgmichel/aiostream#71