11'use strict' ;
22
3- const {
4- SafeSet,
5- } = primordials ;
6-
73let hook ;
84let config ;
95
106function lazyHookCreation ( ) {
117 const inspector = internalBinding ( 'inspector' ) ;
128 const { createHook } = require ( 'async_hooks' ) ;
139 config = internalBinding ( 'config' ) ;
10+ const { kNoPromiseHook } = require ( 'internal/async_hooks' ) ;
1411
1512 hook = createHook ( {
1613 init ( asyncId , type , triggerAsyncId , resource ) {
@@ -19,32 +16,22 @@ function lazyHookCreation() {
1916 // in https://github.com/nodejs/node/pull/13870#discussion_r124515293,
2017 // this should be fine as long as we call asyncTaskCanceled() too.
2118 const recurring = true ;
22- if ( type === 'PROMISE' )
23- this . promiseIds . add ( asyncId ) ;
24- else
25- inspector . asyncTaskScheduled ( type , asyncId , recurring ) ;
19+ inspector . asyncTaskScheduled ( type , asyncId , recurring ) ;
2620 } ,
2721
2822 before ( asyncId ) {
29- if ( this . promiseIds . has ( asyncId ) )
30- return ;
3123 inspector . asyncTaskStarted ( asyncId ) ;
3224 } ,
3325
3426 after ( asyncId ) {
35- if ( this . promiseIds . has ( asyncId ) )
36- return ;
3727 inspector . asyncTaskFinished ( asyncId ) ;
3828 } ,
3929
4030 destroy ( asyncId ) {
41- if ( this . promiseIds . has ( asyncId ) )
42- return this . promiseIds . delete ( asyncId ) ;
4331 inspector . asyncTaskCanceled ( asyncId ) ;
4432 } ,
4533 } ) ;
46-
47- hook . promiseIds = new SafeSet ( ) ;
34+ hook [ kNoPromiseHook ] = true ;
4835}
4936
5037function enable ( ) {
0 commit comments