-
Notifications
You must be signed in to change notification settings - Fork 3k
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(buffer): subscribe to source and closingNotifier in proper order #2195
Conversation
Is this the behavior of RxJS 4? Worth confirming. |
It looks like Rx5 and Rx4 currently differ in behavior, even given the same scheduling. So this is something we need to look at and fix. |
@Blesh const Observable = Rx.Observable;
const xs = Observable.from([0,1,2,3,4,5,6]);
xs.buffer(xs.filter(x => x % 2 === 0))
.subscribe(x => console.log(x)); results in After my change rxjs 5 behaves the same (as seen in my unit test). |
Needs a BREAKING CHANGE disclaimer in the commit message body so that it will show up in our automatic CHANGELOG.md generation. In it, describe what the current (incorrect) behavior is, then what the new behavior is and why it's being changed. Feel free to be verbose if it helps with clarity. |
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.
Otherwise code looks good. Needs more reviews though since this is a fundamental change.
In buffer operator subscribe to source observable first, so that when closingNotifier emits value, all source values emited before land in buffer Closes #1610 BREAKING CHANGE: When source and closingNotifier fire at the same time, it is expected that value emitted by source will first land in buffer and then closingNotifier will close it. Because of reversed subscription order, closingNotifier emitted first, so source was not able to put value in buffer before it was closed. Now source is subscribed before closingNotifier, so if they fire at the same time, source value is put into buffer and then closingNotifer closes it.
@jayphelps done. please let me know if message is ok. ;) |
I changed to base branch aka merge target to Still need one more person to review |
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. |
Description:
In buffer operator subscribe to source observable first, so that when
closingNotifier emits value, all source values emited before land in buffer
Related issue (if exists):
Closes #1610