is broken for RxPY 4.0.4. Instead of printing the output it prints nothing, which is due to the on_error handler being called. Once hooked it states that Future is not iterable.
To Reproduce
python timer.py
Expected behavior
See output
1 seconds
2 seconds
3 seconds
4 seconds
5 seconds
Fix
I believe the correct code should read
with concurrent.futures.ProcessPoolExecutor(5) as executor:
reactivex.from_(seconds).pipe(
ops.flat_map(lambda s: reactivex.from_future(executor.submit(sleep, s)))
).subscribe(output)
Additional context
Linux
RxPY 4.0.4
Python 3.11
Question
Why is flat_map used in this context. Does it enable parallel features in some way compared to map?
Describe the bug
Maybe I'm not seeing something, but I believe the example
https://github.com/ReactiveX/RxPY/blob/master/examples/parallel/timer.py
is broken for RxPY 4.0.4. Instead of printing the output it prints nothing, which is due to the
on_error
handler being called. Once hooked it states thatFuture is not iterable
.To Reproduce
python timer.py
Expected behavior
See output
Fix
I believe the correct code should read
Additional context
Question Why is
flat_map
used in this context. Does it enable parallel features in some way compared tomap
?