Skip to content

Commit 8b57b09

Browse files
trevnorrisaddaleax
authored andcommitted
Revert "async_hooks: only set up hooks if used"
This reverts commit 410b141. PR-URL: #13509 Reviewed-By: Andreas Madsen <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
1 parent a442603 commit 8b57b09

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

lib/async_hooks.js

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,12 @@ const before_symbol = Symbol('before');
4949
const after_symbol = Symbol('after');
5050
const destroy_symbol = Symbol('destroy');
5151

52-
let setupHooksCalled = false;
52+
// Setup the callbacks that node::AsyncWrap will call when there are hooks to
53+
// process. They use the same functions as the JS embedder API.
54+
async_wrap.setupHooks({ init,
55+
before: emitBeforeN,
56+
after: emitAfterN,
57+
destroy: emitDestroyN });
5358

5459
// Used to fatally abort the process if a callback throws.
5560
function fatalError(e) {
@@ -98,16 +103,6 @@ class AsyncHook {
98103
if (hooks_array.includes(this))
99104
return this;
100105

101-
if (!setupHooksCalled) {
102-
setupHooksCalled = true;
103-
// Setup the callbacks that node::AsyncWrap will call when there are
104-
// hooks to process. They use the same functions as the JS embedder API.
105-
async_wrap.setupHooks({ init,
106-
before: emitBeforeN,
107-
after: emitAfterN,
108-
destroy: emitDestroyN });
109-
}
110-
111106
// createHook() has already enforced that the callbacks are all functions,
112107
// so here simply increment the count of whether each callbacks exists or
113108
// not.

0 commit comments

Comments
 (0)