Skip to content

Commit

Permalink
async_hooks: return topmost owner from executionAsyncResource()
Browse files Browse the repository at this point in the history
Signed-off-by: Darshan Sen <darshan.sen@postman.com>
  • Loading branch information
RaisinTen committed Nov 7, 2021
1 parent bea58a1 commit cbb274b
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions lib/internal/async_hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,8 @@ function fatalError(e) {
function lookupPublicResource(resource) {
if (typeof resource !== 'object' || resource === null) return resource;

const publicResource = resource[owner_symbol];

if (publicResource != null) {
return publicResource;
}
let owner;
while ((owner = resource[owner_symbol]) != null) resource = owner;

return resource;
}
Expand Down

0 comments on commit cbb274b

Please sign in to comment.