coder82
09/04/2019, 8:47 AMgildor
09/04/2019, 8:50 AMgildor
09/04/2019, 8:50 AMgildor
09/04/2019, 8:51 AMwhat if all the threads are busy spinningThan coroutine will not be dispatched and will wait in the event queue nothing will be executed
coder82
09/04/2019, 8:52 AMgildor
09/04/2019, 8:53 AMHow to provide backpressureThere is no such mechanins on dispatcher level, task still will be added to event queue Tho, instead of run too many withConttext(IO) you can write own abstraction on top of it that limit amount of requests, for example use Semaphore or worker pool pattern
coder82
09/04/2019, 8:53 AMcoder82
09/04/2019, 8:53 AMgildor
09/04/2019, 8:54 AMcoder82
09/04/2019, 8:54 AMgildor
09/04/2019, 8:54 AMdo is send an http requestWhich can be improved by using asynchronous http client
coder82
09/04/2019, 8:55 AMgildor
09/04/2019, 8:55 AMcoder82
09/04/2019, 8:55 AMgildor
09/04/2019, 8:55 AMparse some xmlWhich sounds more like CPU-bound task, so you should probably use differentt dispatcher for this
coder82
09/04/2019, 8:55 AMcoder82
09/04/2019, 8:56 AMgildor
09/04/2019, 8:56 AMgildor
09/04/2019, 8:57 AMis this Ktor Http Client?<http://httpClient.post|httpClient.post>
coder82
09/04/2019, 8:58 AMcoder82
09/04/2019, 8:58 AMgildor
09/04/2019, 8:58 AMgildor
09/04/2019, 8:58 AMcoder82
09/04/2019, 8:59 AMgildor
09/04/2019, 8:59 AMgildor
09/04/2019, 8:59 AMcoder82
09/04/2019, 9:00 AMcoder82
09/04/2019, 9:01 AMgildor
09/04/2019, 9:01 AMcoder82
09/04/2019, 9:01 AMgildor
09/04/2019, 9:01 AMcoder82
09/04/2019, 9:02 AMgildor
09/04/2019, 9:02 AMwithContext(SomeCPUBoundDispaccther)
, so it will be safe to use this function from any other suspend functioncoder82
09/04/2019, 9:03 AM