Currently merge_all_threads can result in out-of-memory, when concurrent is not Infinity and the source submits items faster than the mapper handles items.
I wonder if we could change the type of concurrent from usize to a struct:
pub struct ConcurrentConfig<F, Item> {
usize max_number_of_inner_observers;
usize max_buffer_size;
F backpressure_handler;
}
impl<F, Item> ConcurrentConfig<F, Item>
where
F: FnMut(Item) -> () {
}
Currently
merge_all_threadscan result in out-of-memory, whenconcurrentis notInfinityand the source submits items faster than the mapper handles items.I wonder if we could change the type of
concurrentfromusizeto astruct: