You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are two effects in play here: fusion and trampolining.
Fusion will take the observeOn queue and just pull on it when the subscription happens. Trampolining will use the last interacting thread (the subscription thread or the termination thread) to pull on the internal queue (dedicated or fused) and when there is an item, it will run the mapper on that thread.
There are two effects in play here: fusion and trampolining.
Fusion will take the
observeOn
queue and just pull on it when the subscription happens. Trampolining will use the last interacting thread (the subscription thread or the termination thread) to pull on the internal queue (dedicated or fused) and when there is an item, it will run the mapper on that thread.This will likely print computation, main, main, main, main.
Workarounds:
hide()
betweenobserveOn
andconcatMap
to break fusion.subscribeOn
afterconcatMap
to move the trampoline off the main thread.defer
+subscribeOn
in the mapper function to calculate the actualFlowable
on a desired thread, not the mapper thread.Appeared on StackOverflow.
The text was updated successfully, but these errors were encountered: