Skip to content
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

Custom Operator wiki article a little out of sync with practice #2144

Closed
davidmoten opened this issue Dec 20, 2014 · 3 comments
Closed

Custom Operator wiki article a little out of sync with practice #2144

davidmoten opened this issue Dec 20, 2014 · 3 comments

Comments

@davidmoten
Copy link
Collaborator

The wiki article Implementing Your Own Operators mentions the following:

Your sequence operator should check its Subscriber's isUnsubscribed( ) status before it emits any item to (or sends any notification to) the Subscriber. Do not waste time generating items that no Subscriber is interested in seeing.

This appears to be a pretty conservative approach given that the base operators of RxJava don't follow this uniformly. For example OperatorDistinct, OperatorMap.

Perhaps the article could add that these checks are not essential if for instance better performance was desired and benchmarks indicated that there was a significant advantage to not making the isUnsubscribed() check.

My rule of thumb at the moment is that when I receive a notification to the parent subscriber I check isUnsubscribed() only when that single notification corresponds to multiple notifications to the child subscriber. Does this seem fair?

So I suspect the article could do with a bit of enhancement in this regard. Any more ideas on what to say?

@davidmoten
Copy link
Collaborator Author

Another useful addition to the wiki article would be a section Testing your Operator that lists the standard tests being discussed in #1962 (like!)

@akarnokd
Copy link
Member

@akarnokd
Copy link
Member

Closing this for now in favor of https://github.com/ReactiveX/RxJava/wiki/Implementing-custom-operators-(draft) . Let me know if something is missing or not explained well.

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

4 participants