-
Notifications
You must be signed in to change notification settings - Fork 302
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
RxQuery violates observable contract #687
Comments
Thanks! Verified this, quote from docs:
Side note: For "regular" observers this is solved by passing a scheduler, e.g.:
Side note: should update the query observers docs to always explicitly specify a scheduler. -Uwe |
If the serialized emitter fix isn't going to be implemented, I would just make it very clear that any multi-threaded scheduler would still recreate this problem. |
In #793 emissions seem to now be synchronized onto a single thread. Because of this, the observable contract shouldn't be violated anymore. |
The observable contract doesn't allow for concurrent calls of onNext/onComplete/or onError. ObjectBox subscriptions can come in on multiple threads concurrently if the database is changing rapidly enough. This would cause onNext to be called concurrently from multiple threads.
Thankfully, the emitter from RxJava has a .serialize() method that you can use to make the emitter safe for this use case. This should fix the issue.
The text was updated successfully, but these errors were encountered: