Skip to content

Commit a4e1755

Browse files
committed
async_hooks: don't read resource if ALS is disabled
Only call executionAsyncResource() in getStore() if the ALS instance is enabled because the resource is not needed otherwise. PR-URL: #34617 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
1 parent 4824988 commit a4e1755

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/async_hooks.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -313,8 +313,8 @@ class AsyncLocalStorage {
313313
}
314314

315315
getStore() {
316-
const resource = executionAsyncResource();
317316
if (this.enabled) {
317+
const resource = executionAsyncResource();
318318
return resource[this.kResourceStore];
319319
}
320320
}

0 commit comments

Comments
 (0)