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

Add multicast tests and fix ConnectableObservable. #720

Closed
wants to merge 3 commits into from

Conversation

staltz
Copy link
Member

@staltz staltz commented Nov 13, 2015

Resolves #657 and solves bug #678. Took some time because #678 was truly a nightmare.

@staltz
Copy link
Member Author

staltz commented Nov 13, 2015

By the way, @trxcllnt you might want to review this if I'm doing any performance mistake. At least there is one closure introduced there. I focused only on getting the bug fixed, we might want to do a second round to make it performant if there's opportunity for that.

@benlesh
Copy link
Member

benlesh commented Nov 18, 2015

@staltz ... can you rebase this one?

Add comprehensive marble tests for multicast operator, including retryability, repeatability,
refCounting, and multiple observers.

Resolves ReactiveX#657.
@staltz
Copy link
Member Author

staltz commented Nov 19, 2015

I just rebased, but now as you can see, tests fail. And the fix isn't immediate. I'm solving some concurrency issues now in ConnectableObservable. I don't know exactly which change to master happened that affected this.

if (++this.refCount === 1) {
this.connection = connectable.connect();
const refCountSubscriber = new RefCountSubscriber(subscriber, this);
refCountSubscriber.myConnection = this.connection;
Copy link
Member

Choose a reason for hiding this comment

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

why is this not added via the constructor above it?

Copy link
Member Author

Choose a reason for hiding this comment

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

It can. What's more important is line 101.

@staltz
Copy link
Member Author

staltz commented Nov 25, 2015

@Blesh I refactored it.

@benlesh
Copy link
Member

benlesh commented Nov 25, 2015

haha... @staltz, this is perfect, but I have one more request. Can you flatten the fix commits? :)

@staltz
Copy link
Member Author

staltz commented Nov 25, 2015

Yes sir I can. I made them separate in the first place because they hold a lot of story (just check the commit message) on how and why did I make those changes.

…and refCounting

When the ConnectableObservable with refCount always shares the same instance of
the underlying subject (such as in publish, publishReplay, publishBehavior), the
subscription to the connectable observable should NOT incur additional subscriptions
to the underlying cold source. See how tests for
publish/publishBehavior/publishReplay were updated to assert that only one
subscription to the underlying cold source happens, not multiple, because as soon
as the multicasting subject raises an error, this error impedes subsequent
subscriptions to the cold source from happening.

Fix ConnectableObservable, its connect() method, and the RefCountObservable to
support synchronous retry/repeat in the presence of multiple subscribers, and to
support retry/repeat in other asynchronous scenarios.

Resolves bug ReactiveX#678.
…bsevable

Clean up unused code in ConnectableObservable, and optimize some reference lookups.
@staltz
Copy link
Member Author

staltz commented Nov 25, 2015

@Blesh Flat it is.

@benlesh
Copy link
Member

benlesh commented Nov 25, 2015

👍 LGTM ... merging in 3... 2... 1...

@benlesh
Copy link
Member

benlesh commented Nov 25, 2015

merged with 20b9a8c... thanks @staltz!

@benlesh benlesh closed this Nov 25, 2015
@staltz staltz deleted the tests-multicast branch November 25, 2015 18:49
@staltz
Copy link
Member Author

staltz commented Nov 25, 2015

That was one hell-ov-a PR.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 18, 2019
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.

2 participants