Re: [whatwg/streams] Cancelling and exception handling async iteration of ReadableStreams (Issue #1255)

@MattiasBuelens Thank you! 

For 1., the problem with using AbortController is that it is the same as the suggestion I made in the bullet:

> - You could set a boolean in the event handler, then in the for loop you could use it to return, cancelling the operation. But this would have to await at least one more chunk, which could in theory take some time to arrive.

So yes, you can throw in the loop on abort or some other signal, or you can just call return to silently exit. The problem is that you only get to do this after a new chunk of data has arrive - right?
So is this a "good" solution?

I was thinking it would be better to call your fetch with the abortcontroller - that would abort the fetch that is supplying your stream, propagating the abort reason from the underlying source. 

So as a general recommendation I was thinking "abort or cancel the underlying source if mechanisms exist, otherwise you will have to wait for the next loop iteration and call break/return (as you indicate).

For 2, I will get back to you on Friday (on another job today).

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

Message ID: <whatwg/streams/issues/1255/1421714494@github.com>

Received on Wednesday, 8 February 2023 00:46:52 UTC