-
Notifications
You must be signed in to change notification settings - Fork 7.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
onComplete() is not getting called on the specified Scheduler #5716
Comments
Yeah, I looked into the code and figured what's causing that. However I believe this is kinda inconsistent behavior, (and probably wrong), since all At least we should have this behavior documented. It's not known that |
I also looked into the source code and figured why this is happening.
|
The operator behaves and expected. If the upstream completes before the time runs out, those events will be delivered on the upstream's thread. If there is a timeout, which is scheduled by a different Scheduler, the terminal event will be delivered on that other thread. If you want to ensure events are delivered on the desired thread, apply If you want, you can create a PR wich add a clause to the relevant operators' Javadoc (in both |
Alright, I'll add it to doc. |
when I use
Observable.take(time, TimeUnit.SECONDS)
, if the result Observable stops due to timeout,onComplete()
callback gets called oncomputation
thread, not the one that I've specified withobserveOn()
.Here is a sample code:
And as the result you'll get
onComplete, thread: RxComputationThreadPool-1
.If it's required for all callback methods to run on the specified thread per Reactive specifications, this would be a bug, and it happens on both RxJava 1.x and 2.x
The text was updated successfully, but these errors were encountered: