Use a direct dispatcher in Flow -> Rx conversions.#592
Use a direct dispatcher in Flow -> Rx conversions.#592
Flow -> Rx conversions.#592Conversation
1025f48 to
311ae10
Compare
There was a problem hiding this comment.
thanks for adding! wondering if this should be moved into another module (e.g. libraries/rib-coroutines)
There was a problem hiding this comment.
Sorry I missed this comment.
I think it's best to have it in "core", because I believe the tendency is for rib-coroutine to cease to exist once we migrate fully to coroutines.
@tyvsmith in case you wanna confirm or deny ^
There was a problem hiding this comment.
np! I see, thanks for clarifying
There was a problem hiding this comment.
Lets move it to ribs-coroutines until we're ready to move all of it to core. Otherwise we're in a worse fragmented state.
|
What do you think if we update WorkerBinder default param value with Unconfined with this new DirectDispatcher? https://github.com/uber/RIBs/blob/main/android/libraries/rib-base/src/main/kotlin/com/uber/rib/core/WorkerBinder.kt#L78 |
|
@FranAguilera that's a good question I think we would be wise to do some benchmarks to measure performance impact of this change and also experiment internally on the safety (stackoverflow risk etc) |
@psteiger Sorry missed this comment earlier. I totally agree, we can put internal doc for steps on measuring impact of this change within our internal repo |
A direct dispatcher mimics the Rx always synchronous-by-default behavior (unless `subscribeOn`/`observeOn` is used), which is different to the `Dispatchers.Unconfined` behavior (default used by `Flow.asObservable`) which may form event loops for nested coroutines (asynchronous).
311ae10 to
760488c
Compare
A direct dispatcher mimics the Rx always synchronous-by-default behavior (unless
subscribeOn/observeOnis used), which is different to theDispatchers.Unconfinedbehavior (default used byFlow.asObservable) which may form event loops for nested coroutines (asynchronous).See Kotlin/kotlinx.coroutines#3760