Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upprocess: refactor promise rejection handling #25200
Conversation
This comment has been minimized.
This comment has been minimized.
nodejs-github-bot
added
C++
lib / src
labels
Dec 24, 2018
This comment has been minimized.
This comment has been minimized.
starkwang
added
the
promises
label
Dec 24, 2018
joyeecheung
force-pushed the
joyeecheung:refactor-tasks
branch
from
147e825
to
698cfad
Dec 25, 2018
This comment has been minimized.
This comment has been minimized.
|
I left the more opinionated refactoring out of this PR and focused on renaming & improving robustness. CI: https://ci.nodejs.org/job/node-test-pull-request/19808/ |
This comment has been minimized.
This comment has been minimized.
|
Resume Build CI: https://ci.nodejs.org/job/node-test-pull-request/19812/ |
| @@ -241,6 +241,8 @@ Environment::Environment(IsolateData* isolate_data, | |||
| if (options_->no_force_async_hooks_checks) { | |||
| async_hooks_.no_force_checks(); | |||
| } | |||
|
|
|||
| isolate()->SetPromiseRejectCallback(task_queue::PromiseRejectCallback); | |||
This comment has been minimized.
This comment has been minimized.
addaleax
Dec 26, 2018
Member
Can you leave a TODO comment for me? We’re letting a single Environment take control of per-Isolate state here – I know it’s been that way before, but it’s not what we should be doing…
This comment has been minimized.
This comment has been minimized.
joyeecheung
Dec 27, 2018
Author
Member
Out of curiosity - when would multiple Environments correspond to an isolate?
This comment has been minimized.
This comment has been minimized.
|
Resume Build CI: https://ci.nodejs.org/job/node-test-pull-request/19824/ |
This comment has been minimized.
This comment has been minimized.
|
Getting closer... Resume Build CI: https://ci.nodejs.org/job/node-test-pull-request/19825/ |
joyeecheung
force-pushed the
joyeecheung:refactor-tasks
branch
from
698cfad
to
4a6765b
Jan 4, 2019
This comment has been minimized.
This comment has been minimized.
|
Addressed the reviews. CI: https://ci.nodejs.org/job/node-test-pull-request/19937/ |
joyeecheung
added
the
author ready
label
Jan 4, 2019
This comment has been minimized.
This comment has been minimized.
|
Landed in f6a1d88...d18b0a0, thanks! |
joyeecheung
closed this
Jan 6, 2019
joyeecheung
removed
the
author ready
label
Jan 6, 2019
This comment has been minimized.
This comment has been minimized.
|
This needs to be backported to v11.x. |
addaleax
added
the
backport-requested-v11.x
label
Jan 9, 2019
BridgeAR
added this to Backport requested
in v11.x
Jan 10, 2019
addaleax
removed
the
backport-requested-v11.x
label
Jan 15, 2019
This comment has been minimized.
This comment has been minimized.
|
This applies cleanly now. :) |
joyeecheung commentedDec 24, 2018
•
edited
It's easier to review without the indentation changes: https://github.com/nodejs/node/pull/25200/files?w=1
src: refactor tickInfo access
kHasScheduledtokHasTickScheduledandkHasPromiseRejectionstokHasRejectionToWarnfor clarity - notethe latter will be set to false if the rejection does not lead to
a warning so the previous description is not accurate.
kHasRejectionToWarnin JS land of relying on C++ to usean implict contract (return value of the promise rejection handler)
to set it, as the decision is made entirely in JS land.
process: make tick callback and promise rejection callback more robust
internalTickCallbacktoprocessTicksAndRejections, makesure it does not get called if it's not set in C++.
emitPromiseRejectionWarningstoprocessPromiseRejectionssince it also emit events that are not warnings.
SetPromiseRejectCallbackin theEnvironmentconstructorto make sure it only gets called once per-isolate, and make
sure it does not get called if it's not set in C++.
listenForRejections().Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes