py06/17/2021, 10:15 PM
louiscad06/17/2021, 10:45 PM
instance, it's part of kotlinx-coroutines-android, I think the implementation it provides is correct for this edge case.
py06/19/2021, 2:42 PM
louiscad06/19/2021, 2:45 PM
Zach Klippenstein (he/him) [MOD]06/19/2021, 2:47 PM
? I didn’t think the
method was allowed to throw, so the execution rejected exception approach wouldn’t work?
py06/19/2021, 5:11 PM
If the underlying executor throws RejectedExecutionException on attempt to submit a continuation task (it happens when closing the resulting dispatcher, on underlying executor shutdown, or when it uses limited queues), then the Job of the affected task is cancelled and the task is submitted to the Dispatchers.IO, so that the affected coroutine can cleanup its resources and promptly complete.
Do you want to send the PR, or should I do it?@louiscad you’re welcome to. This might be quite involved (look at the Executors impl), maybe worth filing an issue?