- Version: 13.x
- Platform: N/A
- Subsystem: Documentation
Additional information
The behaviour of asyncResource.emitDestroy() under async_hooks is somewhat confusing.
Documentation of the options.requireManualDestroy constructor argument property of AsyncResource states that:
(requireManualDestroy: true) Disables automatic emitDestroy when the object is garbage collected. This usually does not need to be set (even if emitDestroy is called manually), unless the resource's asyncId is retrieved and the sensitive API's emitDestroy is called with it. Default: false.
This indicates that asyncResource.emitDestroy() is automatically called by default. However, the following section on emitDestroy() documentation states that:
This must be manually called. If the resource is left to be collected by the GC then the destroy hooks will never be called.
I'm a bit confused about this. Shouldn't this be re-worded in order to convey behaviour of emitDestroy clearly?
PS: I was wondering whether I should create this issue on help repository, but have a feeling that the documentation might have to be amended. Therefore created the issue here.
Additional information
The behaviour of
asyncResource.emitDestroy()underasync_hooksis somewhat confusing.Documentation of the
options.requireManualDestroyconstructor argument property ofAsyncResourcestates that:This indicates that
asyncResource.emitDestroy()is automatically called by default. However, the following section onemitDestroy()documentation states that:I'm a bit confused about this. Shouldn't this be re-worded in order to convey behaviour of
emitDestroyclearly?PS: I was wondering whether I should create this issue on help repository, but have a feeling that the documentation might have to be amended. Therefore created the issue here.