You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I'm experimenting with creating a version of CLS that uses async-hook and AsyncWrap instead of the older AsyncListener and it appears that it very rarely sees parentIds in the init hook.
Is this b/c of NextTickerWrap doesn't pass them? Is there an alternate way to wrap nextTick to include it?
The text was updated successfully, but these errors were encountered:
The parentId for NextTickerWrap is supposed to be null. In the final version of AsyncWrap that will also be the case.
This is because parentId is only set when a handle was directly created as a result of a another handle. Most popular example is a TCP server (parent) creating a TCP socket (child). The much more normal case is that some JavaScript code invoked for example nextTick and that way created a handle object. In this case the handle was created from a callback execution and not another handle.
The standard pattern for tracking the parent is:
track the handle id (currentId) for the currently executing callback using the pre and post hooks.
In the init hook use parent = parentId === null ? currentId : parentId.
Uh oh!
There was an error while loading. Please reload this page.
Hi, I'm experimenting with creating a version of CLS that uses
async-hook
andAsyncWrap
instead of the olderAsyncListener
and it appears that it very rarely sees parentIds in the init hook.Is this b/c of NextTickerWrap doesn't pass them? Is there an alternate way to wrap
nextTick
to include it?The text was updated successfully, but these errors were encountered: