Repository navigation
stream: reject operators on empty streams with aborted signal - #67637
Open
vedchaudhari wants to merge 1 commit into
Open
vedchaudhari wants to merge 1 commit into
vedchaudhari wants to merge 1 commit into
Conversation
Stream operators given an already-aborted signal resolved instead of rejecting when the stream was empty, because the signal was only checked once a chunk arrived. Check it up front in map() and toArray(), which the other operators are built on. Signed-off-by: vedchaudhari <vedc2853@gmail.com>
Collaborator
|
Review requested:
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #67637 +/- ##
=======================================
Coverage 90.71% 90.72%
=======================================
Files 801 801
Lines 280889 280900 +11
Branches 54248 54246 -2
=======================================
+ Hits 254804 254835 +31
+ Misses 16255 16245 -10
+ Partials 9830 9820 -10
🚀 New features to boost your workflow:
|
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.
If an already-aborted signal is passed to a stream operator and the stream is empty, the promise resolves instead of rejecting with an AbortError. For example
Readable.from([]).toArray({ signal: AbortSignal.abort() })resolves with[]. The signal is only checked when a chunk arrives, so with no chunks it never gets checked.reduce(),drop()andtake()already get this right.This checks the signal up front in
map()andtoArray().filter,flatMap,forEach,some,everyandfindare built onmap(), so they're covered too. Tests added for each operator.Assisted-by: an AI coding agent. Reviewed and tested locally by me.