Skip to content

stream: avoid draining merged iter sources#64293

Merged
nodejs-github-bot merged 1 commit into
nodejs:mainfrom
trivikr:stream-iter-merge-drain-consumer-idle
Jul 8, 2026
Merged

stream: avoid draining merged iter sources#64293
nodejs-github-bot merged 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

@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
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
@trivikr trivikr force-pushed the stream-iter-merge-drain-consumer-idle branch from 61b6bd2 to 0b25aaa Compare July 8, 2026 16:05
@codecov

codecov Bot commented Jul 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.25%. Comparing base (799e910) to head (0b25aaa).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #64293   +/-   ##
=======================================
  Coverage   90.25%   90.25%           
=======================================
  Files         741      741           
  Lines      241165   241167    +2     
  Branches    45428    45419    -9     
=======================================
+ Hits       217667   217669    +2     
  Misses      15069    15069           
  Partials     8429     8429           
Files with missing lines Coverage Δ
lib/internal/streams/iter/consumers.js 97.15% <100.00%> (+0.68%) ⬆️

... and 26 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jul 8, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@trivikr trivikr added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Jul 8, 2026
@trivikr trivikr added the commit-queue Add this label to land a pull request using GitHub Actions. label Jul 8, 2026
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Jul 8, 2026
@nodejs-github-bot nodejs-github-bot merged commit 0032189 into nodejs:main Jul 8, 2026
72 checks passed
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Landed in 0032189

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs that have at least one approval, no pending requests for changes, and a CI started. needs-ci PRs that need a full CI run. 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

5 participants