Message382271
It relinquishes control for exactly one event loop cycle.
You'll see that it takes two or three cycles and then gets cancelled correctly.
The reason being is that recovery from your `await asyncio.sleep(1)` takes two or three cycles. (Under the hood, a few `asyncio.call_soon()` are called in a chain and only 1 is executed each cycle).
This is not a bug, but rather intended behavior. You should probably use `asyncio.to_thread()` or preferably run cpu-intensive code on a different process.
@triage Please close as not-a-bug. |
|
Date |
User |
Action |
Args |
2020-12-01 17:47:12 | bar.harel | set | recipients:
+ bar.harel, asvetlov, yselivanov, Davy Durham |
2020-12-01 17:47:12 | bar.harel | set | messageid: <1606844832.05.0.110147128627.issue40800@roundup.psfhosted.org> |
2020-12-01 17:47:12 | bar.harel | link | issue40800 messages |
2020-12-01 17:47:11 | bar.harel | create | |
|