Re: [whatwg/streams] ReadableStreamTee pulls too many chunks (#996)

I have a pretty good idea on how we can fix this. We'll have to borrow some of the logic from `ReadableStreamDefaultControllerCallPullIfNeeded` to check if we are already pulling, and return immediately if we are.

We can even choose whether we want to return the promise of the currently pending pull, or just `undefined`. If we return `undefined` without calling `enqueue()`, the branch won't call `pull()` again until we enqueue a new chunk, which also happens to be the moment when the currently pending pull promise resolves. 🙂

I haven't written a test case for WPT yet, but I can probably come up with something.

-- 
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/996#issuecomment-466154627

Received on Thursday, 21 February 2019 20:30:49 UTC