async_hooks: move to lazy destroy hook registration in AsyncResource · nodejs/node@b632231 · GitHub
Skip to content

Commit b632231

Browse files
puzpuzpuztargos
authored andcommitted
async_hooks: move to lazy destroy hook registration in AsyncResource
PR-URL: #32429 Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de> Reviewed-By: Vladimir de Turckheim <vlad2t@hotmail.com>
1 parent 135f4b9 commit b632231

3 files changed

Lines changed: 14 additions & 2 deletions

File tree

benchmark/async_hooks/gc-tracking.js

Lines changed: 10 additions & 1 deletion

doc/api/async_hooks.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -685,6 +685,8 @@ asyncResource.triggerAsyncId();
685685
when the object is garbage collected. This usually does not need to be set
686686
(even if `emitDestroy` is called manually), unless the resource's `asyncId`
687687
is retrieved and the sensitive API's `emitDestroy` is called with it.
688+
When set to `false`, the `emitDestroy` call on garbage collection
689+
will only take place if there is at least one active `destroy` hook.
688690
**Default:** `false`.
689691

690692
Example usage:

lib/async_hooks.js

Lines changed: 2 additions & 1 deletion

0 commit comments

Comments
 (0)