whatwg / streams

Streams Standard
https://streams.spec.whatwg.org/
Other
1.34k stars 157 forks source link

Fix invalid high water mark for tee branches #1234

Closed yonran closed 2 years ago

yonran commented 2 years ago

strategyHWM must be a positive number because ReadableStreamDefaultControllerShouldCallPull and ReadableByteStreamControllerShouldCallPull return true when desiredSize > 0, so if strategyHWM is zero (and thus desiredSize = strategyHWM - queueTotalSize will initially be 0) the tee branches would signal backpressure forever.

As written, tee() would signal backpressure forever. If this were the case we could take the opportunity to fix the backpressure behavior to fully backpressure to the slower consumer rather than only partial backpressure to the faster consumer (#1233). But alas it looks like various vendors have fixed this bug already at least somewhat.


Preview | Diff