Rx without subscribeOn and observeOn
See original GitHub issueAs I see from our project, I barely see subscribeOn
and observeOn
in api call, how is this possible? even in DetailViewMode, it calls api with .subscribeOn(schedulerProvider.ui())
😲
but the weird part is everything is working just fine, what am I missing here? @rizmaulana
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Understanding RxJava subscribeOn and observeOn
As seen above, subscribeOn() changes the thread on which our Observable is emitted and transformed. In the absence of observeOn() , the results ......
Read more >Rxandroid What's the difference between SubscribeOn and ...
SubscribeOn specify the Scheduler on which an Observable will operate. ObserveOn specify the Scheduler on which an observer will observe ...
Read more >RxJava: subscribeOn vs observeOn - Medium
One of the strongest aspects of RxJava is the simple way to schedule work on a desired thread using either subscribeOn or observeOn...
Read more >Understand subscribeOn and observeOn - effective-rxjava
The subscribeOn method applies to upstream Observable instances. Its Scheduler parameter specifies the thread on which the upstream subscribe method is invoked.
Read more >SubscribeOn operator - ReactiveX
The ObserveOn operator specifies a different Scheduler that the Observable will use to send notifications to its observers. As shown in this illustration,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
subscribeOn
on api call because it is already subscribe on io threads when retrofit initialized, here : https://github.com/rizmaulana/kotlin-mvvm-covid19/blob/master/app/src/main/java/id/rizmaulana/covid19/di/NetworkModule.ktobserveOn(schedulerProvider.ui())
becauseobserve
method on live data already force to running on main thread, we can see howobserve
method works here.subscribeOn(schedulerProvider.ui())
onDetailViewMode
: silly me 😅 it must be. observeOn(schedulerProvider.ui())
, but fortunately we use live data that makes view running on main thread. So it is not breaking. But why it also not blocked the api call when subscribe onmainThread()
? AFAIK, RxJava only accepts firstsubscribeOn
declaration (which is already on io thread) so code.subscribeOn(schedulerProvider.ui())
is ignored, CMIIWalready test it, you can see the test case for DashboardViewModel, there’s no issue for that