Files
node/doc/api
James M Snell d4ec9ff27d stream: reject drop-newest backpressure in shareSync()
With 'drop-newest', a shareSync() consumer that needed to pull while
the buffer was at the budget discarded one entry from the source and
then returned { done: true } even though the source was not exhausted.
for...of loops, and anything else that trusts the iterator protocol,
silently stopped consuming. There is no correct alternative in a
synchronous context: the slowest consumer cannot advance while another
consumer's next() is running, so the call can neither wait for budget
nor keep discarding until budget is released.

Reject 'drop-newest' in shareSync() with ERR_INVALID_ARG_VALUE, as is
already done for 'unbounded'. The two tests that asserted the previous
"done but not detached" behavior are replaced by one that checks the
rejection. Also document how 'unbounded' and 'drop-newest' make the
async share() wait for the slowest consumer.

Assisted-by: OpenCode
Signed-off-by: James M Snell <jasnell@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/66483
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2026-10-10 17:56:08 +00:00
..
2026-09-03 11:40:52 +02:00
2026-09-22 10:59:57 +02:00
2026-10-10 11:21:51 +00:00
2026-10-07 16:40:44 +02:00
2026-09-03 15:37:21 +00:00
2026-09-25 20:28:33 +00:00
2025-12-16 20:31:28 +00:00
2026-10-05 21:26:47 +00:00
2026-09-11 13:15:27 -04:00
2026-10-05 16:47:38 +00:00
2026-08-03 11:44:23 +00:00
2026-09-25 20:28:33 +00:00
2026-09-09 18:04:31 +02:00
2026-10-07 16:40:44 +02:00
2026-10-07 16:40:44 +02:00
2026-10-07 16:40:44 +02:00