Skip to content

stream: avoid draining merged iter sources#64293

Open
trivikr wants to merge 1 commit into
nodejs:mainfrom
trivikr:stream-iter-merge-drain-consumer-idle
Open

stream: avoid draining merged iter sources#64293
trivikr wants to merge 1 commit into
nodejs:mainfrom
trivikr:stream-iter-merge-drain-consumer-idle

Conversation

@trivikr

@trivikr trivikr commented Jul 4, 2026

Copy link
Copy Markdown
Member

Fixes: #63566

stream/iter merge() was scheduling the next read from a source as soon as
that source produced a value. For fast sources, this could drain all inputs even
while the merged consumer was idle after a single next().

This defers each source's next read until the merged iterator resumes after
yielding the previous value.


Assisted-by: openai:gpt-5.5

Defer reading the next value from each source in merge() until the
merged consumer resumes after receiving the previous value.

Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com>
Assisted-by: openai:gpt-5.5
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/streams

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. stream Issues and PRs related to the stream subsystem. labels Jul 4, 2026
@trivikr trivikr added the request-ci Add this label to start a Jenkins CI on a PR. label Jul 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-ci PRs that need a full CI run. request-ci Add this label to start a Jenkins CI on a PR. stream Issues and PRs related to the stream subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

stream/iter: merge() proactively drains fast sources while merged consumer is idle

2 participants