Version
26.2.0
Platform
Subsystem
stream
What steps will reproduce the bug?
import { merge } from 'node:stream/iter';
import { setTimeout as sleep } from 'node:timers/promises';
function source(n) {
return {
pulls: 0,
async *[Symbol.asyncIterator]() {
while (this.pulls < n) yield [Buffer.from(`${++this.pulls}`)];
},
};
}
const a = source(5);
const b = source(5);
const it = merge(a, b)[Symbol.asyncIterator]();
await it.next();
await sleep(20);
console.log({ a: a.pulls, b: b.pulls });
await it.return?.();
How often does it reproduce? Is there a required condition?
Always
What is the expected behavior? Why is that the expected behavior?
after only one await it.next() from the merged iterator, both sources should not be pulled to completion while the merged consumer is idle.
What do you see instead?
Additional information
No response
Version
26.2.0
Platform
Subsystem
stream
What steps will reproduce the bug?
How often does it reproduce? Is there a required condition?
Always
What is the expected behavior? Why is that the expected behavior?
after only one
await it.next()from the merged iterator, both sources should not be pulled to completion while the merged consumer is idle.What do you see instead?
{ a: 5, b: 5 }Additional information
No response