mirror of
https://github.com/nodejs/node.git
synced 2025-08-16 06:08:50 +02:00
async_hooks: move to lazy destroy hook registration in AsyncResource
PR-URL: https://github.com/nodejs/node/pull/32429 Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de> Reviewed-By: Vladimir de Turckheim <vlad2t@hotmail.com>
This commit is contained in:
parent
78e6d2484f
commit
561dda273f
3 changed files with 14 additions and 2 deletions
|
@ -36,6 +36,7 @@ const {
|
|||
emitDestroy,
|
||||
enabledHooksExist,
|
||||
initHooksExist,
|
||||
destroyHooksExist,
|
||||
} = internal_async_hooks;
|
||||
|
||||
// Get symbols
|
||||
|
@ -168,7 +169,7 @@ class AsyncResource {
|
|||
emitInit(asyncId, type, triggerAsyncId, this);
|
||||
}
|
||||
|
||||
if (!requireManualDestroy) {
|
||||
if (!requireManualDestroy && destroyHooksExist()) {
|
||||
// This prop name (destroyed) has to be synchronized with C++
|
||||
const destroyed = { destroyed: false };
|
||||
this[destroyedSymbol] = destroyed;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue