int maxWorkers = 8;
Schedulers.io().when((actions) -> {
return Completable.merge(Flowable.merge(actions, maxWorkers));
});
Wow the documentation of when is really hard to understand. @kim young ill you should really understand what you want to limit from the doc, the scheduler that George is suggesting can deadlock if a you Flowable uses the zip operator. But it might be perfect if just used for simple IO actions.
Scheduler limitScheduler = Schedulers.computation().when(workers -> {
// use merge max concurrent to limit the number of concurrent
// Flowables two at a time // understand two worker at a time
return Completable.merge(Flowable.merge(workers, 2));
});
Scheduler limitScheduler = Schedulers.computation().when(workers -> {
// use merge max concurrent to limit the number of concurrent
// callbacks two at a time // understand two actions at a time
return Completable.merge(Flowable.merge(workers), 2);
});
— Brice