Skip to content

Prevent Duplicate onStart Without Wrapping #3075

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

Closed
benjchristensen opened this issue Jul 14, 2015 · 2 comments
Closed

Prevent Duplicate onStart Without Wrapping #3075

benjchristensen opened this issue Jul 14, 2015 · 2 comments

Comments

@benjchristensen
Copy link
Member

Worth exploring if it is possible to prevent duplicate onStart without wrapping Subscriber. It may not be worth the effort for the small benefit, but it seems wrong we need to wrap just to avoid that.

The duplication comes via lift here:

Examples of wrapping were discussed originally here: #3065 (comment)

@akarnokd
Copy link
Member

One possible solution is that only subscribe() calls onStart automatically, but neither unsafeSubscribe nor lift does it and operators that 'repurpose' their incoming Subscriber have to decide whether it is safe to call onStart or not. I think RxJava 2.0 with the Reactive-Streams API can really resolve this issue for good.

@akarnokd
Copy link
Member

A possible technical solution is to make sources (range, from, Subject) call onStart manually instead of the Observable.subscribe doing it but then all operators' parent Subscriber has to be updated to call onStart on its child subscriber. The problem is, that's a protocol change and existing custom operators outside RxJava won't know to do it and require updates as well.

I don't think this can be solved with 1.x architecture without drastically affecting everything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants