- From: Noam Rosenthal <notifications@github.com>
- Date: Wed, 21 Dec 2022 05:42:33 -0800
- To: whatwg/fetch <fetch@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Wednesday, 21 December 2022 13:42:46 UTC
> LGTM. > > > Two thoughts: > > > > 1. I don't understand how "read all bytes" works as it doesn't seem to yield to the event loop. > > If the stream has unread chunks, the read loop of "read all bytes" will immediately process all of those without yielding. Afterwards, the read request from the read loop will sit in the reader's queue until _something else_ calls ["enqueue"](https://streams.spec.whatwg.org/#readablestream-enqueue). This will synchronously call the "chunk steps" of that read request (through [step 3 in ReadableStreamDefaultControllerEnqueue](https://streams.spec.whatwg.org/commit-snapshots/f894acdd417926a2121710803cef593e15127964/#readable-stream-default-controller-enqueue)) and advance the read loop. > > So indeed, we don't yield to any particular event loop, instead we assume that there's some other event loop out there that's calling "enqueue", and we run the "chunk steps" as part of that same call. Right, which means we might resolve a promise here from a different event loop. I think I can fix it in this PR. -- Reply to this email directly or view it on GitHub: https://github.com/whatwg/fetch/pull/1569#issuecomment-1361327703 You are receiving this because you are subscribed to this thread. Message ID: <whatwg/fetch/pull/1569/c1361327703@github.com>
Received on Wednesday, 21 December 2022 13:42:46 UTC