-
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
A number of improvements to OperatorObserveFromAndroidComponent #931
A number of improvements to OperatorObserveFromAndroidComponent #931
Conversation
- move the UI thread assert out of the operator and into the helpers; this way, we don't fail the observer anymore with an exception, but the caller. - do not loop unsubscribe through the main thread anymore. This unnecessarily defers releasing the references, and might in fact be processed only after Android creates the component after a rotation change. I had to make the references volatile for this to work. - immediately unsubscribe in case we detect the componentRef has become invalid. This solves the problem that dangling observers would continue to listen to notifications with no observer alive anymore. refs: #754 #899
RxJava-pull-requests #871 SUCCESS |
Looks good |
Is this ready to merge? |
I would like to try and see if we can even get rid of the component binding Moreover, I still need to find out why we even appear to need a weak Meanwhile, did anyone else give this a whirl? Ben can we hold on with landing this until next week? I think I won't get
|
@samueltardieu you mentioned you're using A quick recap of those discussions:
Man of these limitations are a direct result of me trying to find a one-size-fits-all solution for observing long running sequences from activities and fragments, but that turned out to be difficult to achieve. In summary this leads me to believe that
This addresses 2. This turned out to work very well with Activities: no need to unsubscribe anymore, and subscribing an activity or an inner observer through this operator makes sure we don't leak the activity. For retained fragments, a weak subscriber binding seems to only be required when using I also need to test a few edge cases with the many ways fragments can be used (for instance, in a fragment |
We have 8 occurrences of Long-running (or infinite) or slow-running observables are subscribed to in Short-running and finite observables are not explicitly unsubscribed, and we could on As far as the fragment is concerned, the subscription is created in I had not realized that those observables could not be subscribed more than once. While this is not a concern today, it might certainly have bitten me in the future, I agree I have tried running the cgeo tests with the content of this PR, and I could not notice anything wrong. However, I am puzzled when you talk about |
Thanks for your input. Sorry for the confusion -- I meant to reference this pull request: #938 It would obsolete any changes in here, but for the time being they're still valuable. |
this is ready to merge then. Let's assume that this operator will stick around until we've found a satisfying solution, whether that be #938 or something else. |
Merging then. Thanks. |
A number of improvements to OperatorObserveFromAndroidComponent
Could I get some eyes on this? @tehmou @zsxwing @benjchristensen
refs:
#754
#899