Skip to content

Commit e45c68a

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 2cd299b commit e45c68a

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
@@ -280,8 +280,8 @@ class AsyncLocalStorage {
280280
}
281281

282282
getStore() {
283-
const resource = executionAsyncResource();
284283
if (this.enabled) {
284+
const resource = executionAsyncResource();
285285
return resource[this.kResourceStore];
286286
}
287287
}

0 commit comments

Comments
 (0)