-
Notifications
You must be signed in to change notification settings - Fork 7
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
breaking: end on read (part 1) #45
base: main
Are you sure you want to change the base?
Conversation
@@ -1405,15 +1384,29 @@ export class MultiTransformIterator<S, D = S> extends TransformIterator<S, D> { | |||
// Remove transformers that have ended | |||
const transformerQueue = this._transformerQueue, optional = this._optional; | |||
let head, item; | |||
while ((head = transformerQueue[0]) && head.transformer.done) { | |||
while ((head = transformerQueue[0]) !== undefined) { |
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.
I feel the changes here could do with a little explanation:
In short - since end
is now triggered by calling .read
, we need to make sure that we now always have triggered at least one .read
call before checking if the iterator is .done
.
At the same time I added the ability to add data from multiple consecutive Transformers in the queue so long as they have data ready; this can reduce excessive calls to _read
if the transformers in the queue only produce a small number of elements each.
@RubenVerborgh this is ready for review - apparently I don't have permissions to set you as a reviewer over here ... |
Copying some test code by @jeswr from #75
|
Note to self: whenever I revisit this PR, I should add some more tests, and review the code, to make sure that |
resolves #25
resolves #35
Part of #43 without any lint or limit changes