asyncio: Gather over growing list of tasks
Justin Paston-Cooper
paston.cooper at gmail.com
Wed Jan 27 11:52:06 EST 2021
Hello,
Let's say I have a loop where at each iteration, a task which makes an
HTTP request to some endpoint is generated, and then the loop sleeps
for n seconds. These tasks may throw exceptions.
I can call asyncio.gather on these tasks once the loop has finished,
but I actually want to stop the loop immediately if an exception is
thrown.
Is there a solution that would allow me to stop this loop as soon as
an exception is thrown by any of these request tasks?
Thanks.
More information about the Python-list
mailing list