Skip to content

Commit cbb274b

Browse files
committed
async_hooks: return topmost owner from executionAsyncResource()
Signed-off-by: Darshan Sen <darshan.sen@postman.com>
1 parent bea58a1 commit cbb274b

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

lib/internal/async_hooks.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -179,11 +179,8 @@ function fatalError(e) {
179179
function lookupPublicResource(resource) {
180180
if (typeof resource !== 'object' || resource === null) return resource;
181181

182-
const publicResource = resource[owner_symbol];
183-
184-
if (publicResource != null) {
185-
return publicResource;
186-
}
182+
let owner;
183+
while ((owner = resource[owner_symbol]) != null) resource = owner;
187184

188185
return resource;
189186
}

0 commit comments

Comments
 (0)