Skip to content

Commit a219173

Browse files
LouisCADgildor
authored andcommitted
Remove unneeded isCancelled check (#41)
This is no longer since invokeOnCompletion (deprected since) has been replaced by invokeOnCancellation.
1 parent deb9a57 commit a219173

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/main/kotlin/ru/gildor/coroutines/retrofit/CallAwait.kt

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,10 @@ public suspend fun <T : Any> Call<T>.awaitResult(): Result<T> {
101101

102102
private fun Call<*>.registerOnCompletion(continuation: CancellableContinuation<*>) {
103103
continuation.invokeOnCancellation {
104-
if (continuation.isCancelled)
105-
try {
106-
cancel()
107-
} catch (ex: Throwable) {
108-
//Ignore cancel exception
109-
}
104+
try {
105+
cancel()
106+
} catch (ex: Throwable) {
107+
//Ignore cancel exception
108+
}
110109
}
111110
}

0 commit comments

Comments
 (0)