Open achimnol opened 2 years ago
We could use two-phase cancellation: requesting cancellation after 1st timeout, cancel cancellation after 2nd timeout if it takes too long, with help of Task.uncancel()
and cancellation scopes to be introduced in Python 3.11.
Currently PersistentTaskGroup immediately cancels all non-finished tasks upon shutdown. Let's add an option for configurable timeout here, so that the individual tasks may have chances to finish up before being cancelled.