You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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?
The text was updated successfully, but these errors were encountered:
The wiki article Implementing Your Own Operators mentions the following:
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?
The text was updated successfully, but these errors were encountered: