Message413478
Guido, the third case:
The third edge case is: explicit cancel() happened *after* the timeout (but still in the
same iteration)?
timeout current-iteration (calls .cancel() after timeout) next-iteration
| | |
>---+----------------------------+---------------------------------+----------> future
a) timeout occurs, `call_later()`' callback is called, the task cancellation is scheduled
on the next loop iteration by `task.cancel()` call
b) other activity (e.g. socket-ready event that processed after timers in asyncio)
explicitly calls `.cancel()`. The second request is ignored, `.cancel()` returns `False`.
c) On the next iteration, the task wakes up with CancelledError with a message that points
on the timeout context manager.
It means that the timeout is processed, explicit `.cancel()` call that happens *after*
timeout is ignored. The first event wins, as usual. |
|
Date |
User |
Action |
Args |
2022-02-18 11:52:10 | asvetlov | set | recipients:
+ asvetlov, gvanrossum, njs, jab, alex.gronholm, chris.jerdonek, yselivanov, tinchester, iritkatriel, ajoino |
2022-02-18 11:52:09 | asvetlov | set | messageid: <1645185129.97.0.773827898036.issue46771@roundup.psfhosted.org> |
2022-02-18 11:52:09 | asvetlov | link | issue46771 messages |
2022-02-18 11:52:09 | asvetlov | create | |
|