Re: [whatwg/streams] Backpressure from tee-ing and slow/pending consumer (#506)

Just to expand on this a bit, this is my plans for our internal "identity transform", or what we call a "pipe".

Consider a pipe with a writer stream feeding a buffer and then a reading stream pulling from the buffer.  A tee operation essentially hangs another reading stream off the same buffer.

This leads to a few different cases:

1. Neither reading stream is being read.  The buffer hits its target limit and the writing stream encounters back pressure.
2. Both reading streams are being read.  The buffer is constantly being drained and the writing stream does not encounter back pressure.  Or if its faster than the readers it gets back pressure like in (1).
3. Reading stream A is being read and reading stream B is not being read.  We cannot simply apply back pressure at the writing stream when the buffer hits its limit due to B not being read.  This would stall out A.  Instead the buffer must be allowed to grow to encompass the difference in read position between A and B.

So the buffer size is MAX(target limit, ABS(A position - B position)).

Anyway, sorry if this is a tangent since its not directly related to ReadableStream and the spec.  Its just my current thinking on the tee operation and backpressure.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/streams/issues/506#issuecomment-242073695

Received on Wednesday, 24 August 2016 13:58:49 UTC