reactormonk
01/08/2025, 5:38 PMCoroutineScope
to be executed when cancel()
is invoked on it?jw
01/08/2025, 5:39 PMscope.launch {
try {
awaitCancelation()
} finally {
doCleanup()
}
}
reactormonk
01/08/2025, 5:40 PMconnectionScope.coroutineContext.job.invokeOnCompletion
, that didn't catchjw
01/08/2025, 5:40 PMcancel()
on it both in the success path and any early-exit pathsZach Klippenstein (he/him) [MOD]
01/08/2025, 6:50 PMDmitry Khalanskiy [JB]
01/09/2025, 10:16 AMlaunch
like this: scope.launch(start = CoroutineStart.ATOMIC) {
. Otherwise, cancellation can happen before the cleanup coroutine is started, so the cleanup code will never run.