https://kotlinlang.org logo
#ktor
Title
# ktor
l

Lucas Milotich

07/02/2021, 9:19 PM
Hello everybody, I would want to know if someone knows what happens with the resources that a client it’s using in a http call if the coroutine is cancelled by any of the previous coroutines . I saw there’s a method in the response class:
Copy code
public fun CoroutineScope.cancel(message: String, cause: Throwable? = null): Unit = cancel(CancellationException(message, cause))
But it just cancel de coroutine and i don’t know what happens with the connection, buffers, etc. Thanks!
a

Aleksei Tirman [JB]

07/05/2021, 10:30 AM
You can wrap it with a
try/finally
or use invokeOnCompletion method to free resources.
🙌 1
l

Lucas Milotich

07/05/2021, 5:15 PM
thanks!