-
Notifications
You must be signed in to change notification settings - Fork 29.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
async_hooks: for promises is PromiseWrap::parentId actually useful? #18470
Comments
@ofrobots Yes, the point of /cc @JiaLiPassion |
@ofrobots , As @AndreasMadsen said, in older version of With the current implementation, I use the |
Thanks for the explanation @JiaLiPassion. The reason I opened this issue is because @AndreasMadsen WDYT? |
@ofrobots , currently The reason Thank you! |
I am not proposing anything be done with the promise on the resource at this point :). Only that we should change the |
@ofrobots , got it. As you said
So I agree we only need to expose a |
Yes, I think |
Given that there is merely a cognitive burden of having too many concepts, I decided not to make a breaking change for this (even though async_hooks is experimental). I think explaining this in the docs addresses the issue. #18633 |
Rename the `parentId` property on the PromiseWrap object to a `isChainedPromise` property. The former wasn't quite useful as it was always defined to be the same value as the trigger id available in the init hook. Instead rename the property to be closer to the information it communicates: whether the promise is a chained promise or not. PR-URL: nodejs#18633 Fixes: nodejs#18470 Reviewed-By: Andreas Madsen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Tiancheng "Timothy" Gu <[email protected]>
Rename the `parentId` property on the PromiseWrap object to a `isChainedPromise` property. The former wasn't quite useful as it was always defined to be the same value as the trigger id available in the init hook. Instead rename the property to be closer to the information it communicates: whether the promise is a chained promise or not. PR-URL: #18633 Fixes: #18470 Reviewed-By: Andreas Madsen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Tiancheng "Timothy" Gu <[email protected]>
Rename the `parentId` property on the PromiseWrap object to a `isChainedPromise` property. The former wasn't quite useful as it was always defined to be the same value as the trigger id available in the init hook. Instead rename the property to be closer to the information it communicates: whether the promise is a chained promise or not. PR-URL: #18633 Fixes: #18470 Reviewed-By: Andreas Madsen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Tiancheng "Timothy" Gu <[email protected]>
Rename the `parentId` property on the PromiseWrap object to a `isChainedPromise` property. The former wasn't quite useful as it was always defined to be the same value as the trigger id available in the init hook. Instead rename the property to be closer to the information it communicates: whether the promise is a chained promise or not. PR-URL: #18633 Fixes: #18470 Reviewed-By: Andreas Madsen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Tiancheng "Timothy" Gu <[email protected]>
Rename the `parentId` property on the PromiseWrap object to a `isChainedPromise` property. The former wasn't quite useful as it was always defined to be the same value as the trigger id available in the init hook. Instead rename the property to be closer to the information it communicates: whether the promise is a chained promise or not. PR-URL: #18633 Fixes: #18470 Reviewed-By: Andreas Madsen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Tiancheng "Timothy" Gu <[email protected]>
Rename the `parentId` property on the PromiseWrap object to a `isChainedPromise` property. The former wasn't quite useful as it was always defined to be the same value as the trigger id available in the init hook. Instead rename the property to be closer to the information it communicates: whether the promise is a chained promise or not. PR-URL: nodejs#18633 Fixes: nodejs#18470 Reviewed-By: Andreas Madsen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Tiancheng "Timothy" Gu <[email protected]>
Rename the `parentId` property on the PromiseWrap object to a `isChainedPromise` property. The former wasn't quite useful as it was always defined to be the same value as the trigger id available in the init hook. Instead rename the property to be closer to the information it communicates: whether the promise is a chained promise or not. PR-URL: #18633 Fixes: #18470 Reviewed-By: Andreas Madsen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Tiancheng "Timothy" Gu <[email protected]>
Rename the `parentId` property on the PromiseWrap object to a `isChainedPromise` property. The former wasn't quite useful as it was always defined to be the same value as the trigger id available in the init hook. Instead rename the property to be closer to the information it communicates: whether the promise is a chained promise or not. PR-URL: #18633 Fixes: #18470 Reviewed-By: Andreas Madsen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Tiancheng "Timothy" Gu <[email protected]>
Rename the `parentId` property on the PromiseWrap object to a `isChainedPromise` property. The former wasn't quite useful as it was always defined to be the same value as the trigger id available in the init hook. Instead rename the property to be closer to the information it communicates: whether the promise is a chained promise or not. PR-URL: #18633 Fixes: #18470 Reviewed-By: Andreas Madsen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Tiancheng "Timothy" Gu <[email protected]>
Rename the `parentId` property on the PromiseWrap object to a `isChainedPromise` property. The former wasn't quite useful as it was always defined to be the same value as the trigger id available in the init hook. Instead rename the property to be closer to the information it communicates: whether the promise is a chained promise or not. PR-URL: #18633 Fixes: #18470 Reviewed-By: Andreas Madsen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Tiancheng "Timothy" Gu <[email protected]>
Rename the `parentId` property on the PromiseWrap object to a `isChainedPromise` property. The former wasn't quite useful as it was always defined to be the same value as the trigger id available in the init hook. Instead rename the property to be closer to the information it communicates: whether the promise is a chained promise or not. PR-URL: #18633 Fixes: #18470 Reviewed-By: Andreas Madsen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Tiancheng "Timothy" Gu <[email protected]>
On PromiseWrap objects we expose a
parentId
property:node/src/async_wrap.cc
Lines 385 to 387 in 0993fbe
The semantics of the property are:
parentId
must match thetriggerAsyncId
available in theInit
hook, as the parent promise is the trigger (cause) of the child async resource (promise) to be created. TheparentId
is redundant information in this case.parentId
would be different fromtriggerAsyncId
is when a promise has no parent. In this case theparentId
will beundefined
and thetriggerAsyncId
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
The text was updated successfully, but these errors were encountered: