-
Notifications
You must be signed in to change notification settings - Fork 145
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 mergeLimit function as mentioned in #374 #375
Conversation
This breaks backpressure. You should be using modified version of the current implementation of You all so need to add a |
* | ||
* _([txt, md, js]).mergeLimit(2); | ||
* // => contents of foo.txt, bar.txt, baz.txt and bosh.js in the order | ||
* they were read, but bosh is not read until the others have comleted |
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.
Typo in "comleted". Also, this wording suggests bosh won't be read until both bar and baz have completed. I suggest "but bosh is not read until either foo/bar or baz has finished.
Finally, let's call this |
649928f
to
44464fc
Compare
Yes that did break back-pressure, Instead of modifying the merge function I've made it so that there is just a transform function before the merge which prevents the stream from pushing any values until something from the current working set has ended. |
push(err, x); | ||
// console.log('start', x.id) | ||
x.once('end', function(){ | ||
// console.log('end', x.id) |
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.
Your indentation for x.once
is off. Also, I think you want to do index--
in the end
handler, right?
Oh, nice. That's a much better idea. |
Yea if I don't index-- when the substream ends it will end up only allowing 1 process to run at a time. I've added that in and renamed index to processCount so that it is more descriptive. |
* | ||
* @id mergeLimit | ||
* @section Higher-order Streams | ||
* @name Stream.mergeWithLimit() |
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.
Call this @name Stream.mergeWithLimit(n)
.
The @id
field should be @id mergeWithLimit
.
You also need to add a @param n
field for the parameter.
I think this is ready as soon as you fix a few issues with the documentation. |
A couple of stray |
Cool. Commented Thanks, @dayoadeyemi for the PR! |
Add mergeLimit function. Resolves #374.
No description provided.