Albert
08/14/2018, 12:02 PMasync { ... http request ... }
at some point I am hitting connection refused, because the other end can not keep up.Vsevolod Tolstopyatov [JB]
08/14/2018, 12:15 PMsuspend
-based http-client (Ktor or any adapter around existing async clients), then there is no built-in solution and limiting threads count won’t help.
https://github.com/Kotlin/kotlinx.coroutines/issues/460 may help, feel free to vote for it.
As ad-hoc solution you can use suspend-based Semaphore (it was posted in a thread above)