Skip to content

Commit

Permalink
Remove unneeded isCancelled check (#41)
Browse files Browse the repository at this point in the history
This is no longer since invokeOnCompletion (deprected since) has been replaced by invokeOnCancellation.
  • Loading branch information
LouisCAD authored and gildor committed Jul 15, 2018
1 parent deb9a57 commit a219173
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/main/kotlin/ru/gildor/coroutines/retrofit/CallAwait.kt
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,10 @@ public suspend fun <T : Any> Call<T>.awaitResult(): Result<T> {

private fun Call<*>.registerOnCompletion(continuation: CancellableContinuation<*>) {
continuation.invokeOnCancellation {
if (continuation.isCancelled)
try {
cancel()
} catch (ex: Throwable) {
//Ignore cancel exception
}
try {
cancel()
} catch (ex: Throwable) {
//Ignore cancel exception
}
}
}

0 comments on commit a219173

Please sign in to comment.