File tree Expand file tree Collapse file tree 1 file changed +6
-11
lines changed Expand file tree Collapse file tree 1 file changed +6
-11
lines changed Original file line number Diff line number Diff line change @@ -49,7 +49,12 @@ const before_symbol = Symbol('before');
49
49
const after_symbol = Symbol ( 'after' ) ;
50
50
const destroy_symbol = Symbol ( 'destroy' ) ;
51
51
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 } ) ;
53
58
54
59
// Used to fatally abort the process if a callback throws.
55
60
function fatalError ( e ) {
@@ -98,16 +103,6 @@ class AsyncHook {
98
103
if ( hooks_array . includes ( this ) )
99
104
return this ;
100
105
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
-
111
106
// createHook() has already enforced that the callbacks are all functions,
112
107
// so here simply increment the count of whether each callbacks exists or
113
108
// not.
You can’t perform that action at this time.
0 commit comments