Message316866
"""
At the moment this can be done but it will cancel all the coroutines with any exception that is raised and at some occasions this may not be desired.
"""
Does wait() really "cancel all the coroutines"? The documentation doesn't mention wait() canceling anything it only returns them in the `pending` set. It is gather() and wait_for() that cancel automatically.
If you want to cancel everything on some exception and not on another, you can easily implement the logic yourself, e.g:
tasks = [asyncio.ensure_future(example(x)) for x in range(20)]
done, pending = await asyncio.wait(tasks, return_when=FIRST_EXCEPTION)
for fut in done:
try:
fut.result()
except CancelException:
for fut in pending:
fut.cancel() |
|
Date |
User |
Action |
Args |
2018-05-16 20:49:09 | hniksic | set | recipients:
+ hniksic, giampaolo.rodola, asvetlov, yselivanov, pyneda |
2018-05-16 20:49:09 | hniksic | set | messageid: <1526503749.67.0.682650639539.issue33403@psf.upfronthosting.co.za> |
2018-05-16 20:49:09 | hniksic | link | issue33403 messages |
2018-05-16 20:49:09 | hniksic | create | |
|