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

fix(multicast): Fixes multicast with selector to create a new source connection per subscriber. #1774

Merged
merged 1 commit into from
Jun 16, 2016

Conversation

trxcllnt
Copy link
Member

Description:
Multicast with a selector function should create a new ConnectableObservable for each subscriber to
the MulticastObservable. This ensures each subscriber creates a new connection to the source
Observable, and don't share subscription side-effects.

Multicast with selector now matches Rx4's behavior.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.0006%) to 96.362% when pulling 4aa9041 on trxcllnt:fix-multicast-observable into de39b5e on ReactiveX:master.

const sourceSubs = ['^ !'];
const sourceSubs = ['^ !',
' ^ !',
' ^ !'];
const multicasted = source.multicast(() => new Subject(),
x => x.zip(x, (a, b) => (parseInt(a) + parseInt(b)).toString()));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In here, can we assert that x is something expected? Also, can we return something more clear? Maybe a simple map like: x.map(v => v + '!'). Then just use the values argument to expectObservable to assert.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Blesh the point of multicast with a selector is to allow multiple subscriptions to the multicast Observable inside the selector function, and one source connection per outer subscriber. By zipping x with itself, this test is guaranteeing two subscriptions to x for each connection to the multicast source.

I think this is a good test, but I'll add a test with a cold source as well to cover all cases.

@benlesh
Copy link
Member

benlesh commented Jun 16, 2016

Good catch @trxcllnt! Just one little thing in the test

…connection per subscriber.

Multicast with a selector function should create a new ConnectableObservable for each subscriber to
the MulticastObservable. This ensures each subscriber creates a new connection to the source
Observable, and don't share subscription side-effects.
@coveralls
Copy link

Coverage Status

Coverage increased (+0.0006%) to 96.362% when pulling ca361e4 on trxcllnt:fix-multicast-observable into c7e2366 on ReactiveX:master.

@benlesh benlesh merged commit c3ac852 into ReactiveX:master Jun 16, 2016
@trxcllnt trxcllnt deleted the fix-multicast-observable branch June 23, 2016 18:28
@lock
Copy link

lock bot commented Jun 6, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants