Tolriq
11/05/2018, 10:59 AMinterface Host {
suspend fun getMovies() : List<Movies>
suspend fun setWatched(movie:Movie) : Boolean
.....
}
Imagine a lot more functions. At any given moment there should be no more than X functions running.
Ideally the limit should only apply to the actual server communication and the transformation of received data, should not be limited to allow faster command enqueing.
The interface does implement close() that should also cancel all running coroutines for the host.
My solution with blocking calls, would be to have a dedicated thread pool as dispatcher and use withcontext for the network call, but this is not efficient and no more works if some of the calls are non blocking and can switch to IO for example.
I'd really appreciate some help on how to apprehend this needs, as it's major refactoring so needs to be done correctly 🙂Jonathan
11/05/2018, 12:30 PMnewFixedThreadPoolContext
. Also have a look at https://github.com/Kotlin/kotlinx.coroutines/issues/261Tolriq
11/05/2018, 1:01 PMZach Klippenstein (he/him) [MOD]
11/05/2018, 6:51 PMTolriq
11/05/2018, 9:25 PMZach Klippenstein (he/him) [MOD]
11/06/2018, 12:04 AMTolriq
11/06/2018, 9:30 AM