I use Ktor 1.6.8 and to work in parallel (multiple...
# ktor
I use Ktor 1.6.8 and to work in parallel (multiple NSThreads) on iOS I call my httpClient.get() inside a
CoroutineWorker.withContext(Dispatchers.Default) {}
block. I use the
for my HttpClient. In normal conditions it works fine, but in a CoroutineWorker context I get
kotlin.native.concurrent.FreezingException: freezing of InvokeOnCompletion@e9e588[job@149d2c8] has failed, first blocker is BlockingCoroutine{Completing}@e5b248
Because it's not production ready I can't really use the new memory model yet. So I need to solve it with the old one and CoroutineWorker. How do I need to wrap my KTor HttpClient calls?
Hi @Stefan Oltmann, could you try it with 2.0.2 and new memory model? It should be fixed
@e5l That would not help me. The new memory model is not production ready right now. I need a solution for the old memory model.
Reading trough the issues on GitHub it looks like that KTor 1.x is incompatible with CoroutinesWorker. So there is no way for me to get that working. Is that correct?
Yep, there is an issue with old memory model so it’s unsafe to execute NSUrlRequest callbacks on arbitrary thread. It’s explicitly disabled with old memory model
Thank you! That was the clear answer I was looking for.