Hey there. What is the best co-routine way to process n batches in parallel? For each batch I need to make a remote call. It's okay if one of batches fails. Do I want to take a look into flows?
z
Zach Klippenstein (he/him) [MOD]
09/05/2020, 10:32 PM
You could use Flow (flatMap takes a concurrency parameter). You could also just use a semaphore and launch coroutines yourself. You could also use a worker pool (launch n coroutines all reading from the same channel)
d
df
09/05/2020, 10:33 PM
Hehe that pretty much confirms the impression I got from reading the co-routine chapter. Differentr ways and not sure which one to choose when