mirror of
https://github.com/nodejs/node.git
synced 2025-08-15 13:48:44 +02:00
async_hooks: add executionAsyncResource
Remove the need for the destroy hook in the basic APM case. Co-authored-by: Stephen Belanger <admin@stephenbelanger.com> PR-URL: https://github.com/nodejs/node/pull/30959 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Vladimir de Turckheim <vlad2t@hotmail.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
parent
1c11ea4388
commit
9fdb6e6aaf
19 changed files with 458 additions and 57 deletions
|
@ -25,6 +25,7 @@ const {
|
|||
getHookArrays,
|
||||
enableHooks,
|
||||
disableHooks,
|
||||
executionAsyncResource,
|
||||
// Internal Embedder API
|
||||
newAsyncId,
|
||||
getDefaultTriggerAsyncId,
|
||||
|
@ -176,7 +177,7 @@ class AsyncResource {
|
|||
|
||||
runInAsyncScope(fn, thisArg, ...args) {
|
||||
const asyncId = this[async_id_symbol];
|
||||
emitBefore(asyncId, this[trigger_async_id_symbol]);
|
||||
emitBefore(asyncId, this[trigger_async_id_symbol], this);
|
||||
|
||||
const ret = thisArg === undefined ?
|
||||
fn(...args) :
|
||||
|
@ -211,6 +212,7 @@ module.exports = {
|
|||
createHook,
|
||||
executionAsyncId,
|
||||
triggerAsyncId,
|
||||
executionAsyncResource,
|
||||
// Embedder API
|
||||
AsyncResource,
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue