On PromiseWrap objects we expose a parentId property:
|
promise_wrap_template->SetAccessor( |
|
FIXED_ONE_BYTE_STRING(env->isolate(), "parentId"), |
|
PromiseWrap::getParentAsyncId); |
.
The semantics of the property are:
- If the promise has a parent promise, parentId will be the asyncId of the parent promise. By definition, and by implementation,
parentId must match the triggerAsyncId available in the Init hook, as the parent promise is the trigger (cause) of the child async resource (promise) to be created. The parentId is redundant information in this case.
- The only case where
parentId would be different from triggerAsyncId is when a promise has no parent. In this case the parentId will be undefined and the triggerAsyncId would correspond to the current execution id.
It seems the only information that parentId provides is whether or not (i.e boolean) the promise has a parent.
Is there something more subtle here that I might be missing? I'd like to go ahead and document that if that's the case.
/cc @nodejs/diagnostics @nodejs/async_hooks
On PromiseWrap objects we expose a
parentIdproperty:node/src/async_wrap.cc
Lines 385 to 387 in 0993fbe
The semantics of the property are:
parentIdmust match thetriggerAsyncIdavailable in theInithook, as the parent promise is the trigger (cause) of the child async resource (promise) to be created. TheparentIdis redundant information in this case.parentIdwould be different fromtriggerAsyncIdis when a promise has no parent. In this case theparentIdwill beundefinedand thetriggerAsyncIdwould correspond to the current execution id.It seems the only information that
parentIdprovides is whether or not (i.e boolean) the promise has a parent.Is there something more subtle here that I might be missing? I'd like to go ahead and document that if that's the case.
/cc @nodejs/diagnostics @nodejs/async_hooks