process: handle rejections only when needed#62919
Open
gurgunday wants to merge 1 commit intonodejs:mainfrom
Open
process: handle rejections only when needed#62919gurgunday wants to merge 1 commit intonodejs:mainfrom
gurgunday wants to merge 1 commit intonodejs:mainfrom
Conversation
Signed-off-by: Gürgün Dayıoğlu <[email protected]>
Member
Author
|
Cc @nodejs/performance since they weren't tagged |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #62919 +/- ##
==========================================
- Coverage 89.68% 89.63% -0.05%
==========================================
Files 706 706
Lines 218223 219206 +983
Branches 41768 42006 +238
==========================================
+ Hits 195703 196488 +785
- Misses 14426 14610 +184
- Partials 8094 8108 +14
🚀 New features to boost your workflow:
|
Qard
approved these changes
Apr 25, 2026
IlyasShabi
approved these changes
Apr 25, 2026
Collaborator
mertcanaltin
approved these changes
Apr 25, 2026
Collaborator
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.
After:
Before:
processPromiseRejections()calls inprocessTicksAndRejections()when there is no pending rejection workWe already do a check before entering the loop through
runNextTicks():node/lib/internal/process/task_queues.js
Lines 62 to 70 in 926162a
But once we are already inside
processTicksAndRejections()because of tick work, the internal do..while loop still callsprocessPromiseRejections()on every iteration (where we have a Map instantiation, method calls, etc.) without checking if we should even call it:node/lib/internal/process/task_queues.js
Line 105 in 926162a
node/lib/internal/process/promises.js
Lines 377 to 424 in 012bf70
Now the name
hasRejectionToWarnis inaccurate because we use it for any type of unhandled rejection:node/lib/internal/process/promises.js
Lines 193 to 206 in 012bf70
So skipping covers all types of rejections