-
Notifications
You must be signed in to change notification settings - Fork 751
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
Add lazy RefCount operator for IObservables. #133
Conversation
…pefully equivalent to my pull request to Rx.net (dotnet/reactive#133). Once this is merged, this implementation will be removed.
How about just adding a |
I'm ok with that. Having an overload instead of a new operator would reflect the sanity of the idea even more and show that this is indeed useful. Shall I change it now? |
👍 to an overload on |
Would it also make sense to reuse the implementation? The classic operator would then just call the new overload passing |
if (parent._connectableSubscription == null) | ||
parent._connectableSubscription = parent._source.Connect(); | ||
|
||
parent._serial.Disposable = new SingleAssignmentDisposable(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd move this earlier so that the timeout task is cancelled as soon as possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd call it still RefCount
. It has a better discoverability and user's would look for this behavior under RefCount
anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could generate the homoiconic IQbservable
operators, instead of excluding it from the parity check.
… like RefCount but may delay disconnection. This is useful whenever a lot of connect/disconnect cycles are expected within a short timespan but with a significant overhead in connecting/disconnecting. Some unit tests have been added. Lazy RefCount has been excluded from methods that must be present for Qbservable as well. I leave it up to others to decide what Lazy RefCount means for Qbservable and whether there should be an implementation.
LazyRefCount connects like RefCount but may delay disconnection. This is useful whenever a lot of connect/disconnect cycles are expected within a short timespan but with a significant overhead in connecting/disconnecting.
This change is