Skip to content

Commit 61683e1

Browse files
Flarnaaddaleax
authored andcommitted
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 35ff592 commit 61683e1

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
@@ -277,8 +277,8 @@ class AsyncLocalStorage {
277277
}
278278

279279
getStore() {
280-
const resource = executionAsyncResource();
281280
if (this.enabled) {
281+
const resource = executionAsyncResource();
282282
return resource[this.kResourceStore];
283283
}
284284
}

0 commit comments

Comments
 (0)