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(bufferCount): set default value for skip argument, do not emit em… #271

Merged
merged 1 commit into from
Sep 6, 2015

Conversation

kwonoj
Copy link
Member

@kwonoj kwonoj commented Sep 5, 2015

…pty buffer at the end.

Found while try to write micro perf test for bufferCount, when bufferCount does not have explicit skip argument (startBufferEvery parameter) it only emits very first buffer element then completes observable. This PR aligns bufferCount behaves as same as current bufferWithCount (https://github.com/Reactive-Extensions/RxJS/blob/master/doc/api/core/operators/bufferwithcount.md) by set default skip argument to size of buffer if it's not specified.

@@ -33,7 +33,7 @@ class BufferCountSubscriber<T> extends Subscriber<T> {
const count = (this.count += 1);
const destination = this.destination;
const bufferSize = this.bufferSize;
const startBufferEvery = this.startBufferEvery;
const startBufferEvery = (this.startBufferEvery == null) ? bufferSize : this.startBufferEvery;
Copy link
Member Author

Choose a reason for hiding this comment

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

Some of other operator such as windowCount has default value as 0 instead of null. Not sure if there's consistent recommendation or guidelines, so did not modify default value itself but simply take buffersize if value's not specified.

@benlesh
Copy link
Member

benlesh commented Sep 6, 2015

Good catch. I suspect we'll be finding lots of bugs like this as we convert tests over to use the Virtual Time Scheduler and expand testing to cover more scenarios.

@benlesh benlesh merged commit 2c1a9dc into ReactiveX:master Sep 6, 2015
@benlesh
Copy link
Member

benlesh commented Sep 6, 2015

Thanks @kwonoj!

@kwonoj kwonoj deleted the fix-operator-buffercount branch September 6, 2015 18:04
@lock lock bot locked as resolved and limited conversation to collaborators Jan 19, 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