stream: reject iter consumers on abort#64066
Open
trivikr wants to merge 2 commits into
Open
Conversation
Make stream/iter async consumers observe abort signals while waiting for a pending async iterator read. This lets bytes(), text(), arrayBuffer(), and array() reject promptly with the abort reason instead of waiting for another batch. Move the shared abort-aware iterator wrapper to stream/iter utils so pull and consumers use the same helper. Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com> Assisted-by: openai:gpt-5.5
Collaborator
|
Review requested:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes: #64065
This updates
node:stream/iterasync consumers to reject promptly whentheir abort signal fires while an async iterator read is pending.
Previously,
bytes(),text(),arrayBuffer(), andarray()only checkedthe signal before and after receiving a batch. If the source was stuck in a
pending
next(), aborting the signal did not settle the consumer promise.The change reuses the abort-aware iterator wrapper from the pull pipeline by
moving it into shared stream/iter utils, then applies it in consumers before
normalization and while consuming the normalized source.
Assisted-by: openai:gpt-5.5