<@U0BRK9HC5> could you please explain why we need ...
# coroutines
d
@gildor could you please explain why we need this extra code in each coroutine in the
kotlin-coroutines-retrofit
lib?
Copy code
private fun Call<*>.registerOnCompletion(continuation: CancellableContinuation<*>) {
    continuation.invokeOnCompletion {
        if (continuation.isCancelled)
            try {
                cancel()       // why to cancel already cancelled coroutine?
            } catch (ex: Throwable) {
                //Ignore cancel exception
            }
    }
}
g
If coroutine is cancelled, then we should cancel retrofit request
d
yes, thanks. already realized this. initially i thought
cancel
is related to
invokeOnCompletion
lambda 😚