I'm building a massively concurrent system with coroutines, have thousands of coroutines running at a time, and have 100% CPU usage most of the time. It all works great, but how can I give some coroutines higher priority? Sometimes I have work incoming that should be completed first, but because the application is already busy with other stuff the priority work has to wait for other work to finish before being processed. Alternatively, how can I start some coroutines on a low-priority thread, which should let me achieve the same goal?
o
octylFractal
07/05/2020, 10:08 PM
make your own dispatcher using
Executor.asCoroutineDispatcher()
m
Marcin Wisniowski
07/05/2020, 10:19 PM
Oh, that makes sense, I was looking at CoroutineDispatchers but haven't seen that you can make one from an Executor. Thank you.