File tree Expand file tree Collapse file tree 5 files changed +8
-19
lines changed Expand file tree Collapse file tree 5 files changed +8
-19
lines changed Original file line number Diff line number Diff line change @@ -532,7 +532,7 @@ function emitAfterScript(asyncId) {
532
532
533
533
function emitDestroyScript ( asyncId ) {
534
534
// Return early if there are no destroy callbacks, or invalid asyncId.
535
- if ( ! hasHooks ( kDestroy ) || asyncId <= 0 )
535
+ if ( ! hasHooks ( kDestroy ) || ! ( asyncId > 0 ) )
536
536
return ;
537
537
async_wrap . queueDestroyAsyncId ( asyncId ) ;
538
538
}
Original file line number Diff line number Diff line change @@ -27,7 +27,6 @@ const {
27
27
getDefaultTriggerAsyncId,
28
28
newAsyncId,
29
29
initHooksExist,
30
- destroyHooksExist,
31
30
emitInit,
32
31
emitBefore,
33
32
emitAfter,
@@ -94,8 +93,7 @@ function processTicksAndRejections() {
94
93
}
95
94
}
96
95
} finally {
97
- if ( destroyHooksExist ( ) )
98
- emitDestroy ( asyncId ) ;
96
+ emitDestroy ( asyncId ) ;
99
97
}
100
98
101
99
emitAfter ( asyncId ) ;
Original file line number Diff line number Diff line change @@ -92,7 +92,6 @@ const {
92
92
getDefaultTriggerAsyncId,
93
93
newAsyncId,
94
94
initHooksExist,
95
- destroyHooksExist,
96
95
// The needed emit*() functions.
97
96
emitInit,
98
97
emitBefore,
@@ -508,8 +507,7 @@ function getTimerCallbacks(runNextTicks) {
508
507
} finally {
509
508
immediate . _onImmediate = null ;
510
509
511
- if ( destroyHooksExist ( ) )
512
- emitDestroy ( asyncId ) ;
510
+ emitDestroy ( asyncId ) ;
513
511
514
512
outstandingQueue . head = immediate = immediate . _idleNext ;
515
513
}
@@ -585,8 +583,7 @@ function getTimerCallbacks(runNextTicks) {
585
583
if ( timer [ kRefed ] )
586
584
timeoutInfo [ 0 ] -- ;
587
585
588
- if ( destroyHooksExist ( ) )
589
- emitDestroy ( asyncId ) ;
586
+ emitDestroy ( asyncId ) ;
590
587
}
591
588
continue ;
592
589
}
@@ -621,8 +618,7 @@ function getTimerCallbacks(runNextTicks) {
621
618
if ( timer [ kRefed ] )
622
619
timeoutInfo [ 0 ] -- ;
623
620
624
- if ( destroyHooksExist ( ) )
625
- emitDestroy ( asyncId ) ;
621
+ emitDestroy ( asyncId ) ;
626
622
}
627
623
}
628
624
Original file line number Diff line number Diff line change @@ -63,7 +63,6 @@ let timersPromises;
63
63
let timers ;
64
64
65
65
const {
66
- destroyHooksExist,
67
66
// The needed emit*() functions.
68
67
emitDestroy,
69
68
} = require ( 'internal/async_hooks' ) ;
@@ -78,9 +77,7 @@ function unenroll(item) {
78
77
if ( item [ kHasPrimitive ] )
79
78
delete knownTimersById [ item [ async_id_symbol ] ] ;
80
79
81
- // Fewer checks may be possible, but these cover everything.
82
- if ( destroyHooksExist ( ) && item [ async_id_symbol ] !== undefined )
83
- emitDestroy ( item [ async_id_symbol ] ) ;
80
+ emitDestroy ( item [ async_id_symbol ] ) ;
84
81
85
82
L . remove ( item ) ;
86
83
@@ -239,9 +236,7 @@ function clearImmediate(immediate) {
239
236
}
240
237
immediate [ kRefed ] = null ;
241
238
242
- if ( destroyHooksExist ( ) && immediate [ async_id_symbol ] !== undefined ) {
243
- emitDestroy ( immediate [ async_id_symbol ] ) ;
244
- }
239
+ emitDestroy ( immediate [ async_id_symbol ] ) ;
245
240
246
241
immediate . _onImmediate = null ;
247
242
Original file line number Diff line number Diff line change 1
1
Error: test
2
2
at one (*fixtures*async-error.js:4:9)
3
3
at two (*fixtures*async-error.js:17:9)
4
- at process.processTicksAndRejections (node:internal*process*task_queues:105 :5)
4
+ at process.processTicksAndRejections (node:internal*process*task_queues:103 :5)
5
5
at async three (*fixtures*async-error.js:20:3)
6
6
at async four (*fixtures*async-error.js:24:3)
7
7
at async main (*async_error_nexttick_main.js:7:5)
You can’t perform that action at this time.
0 commit comments