mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
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: https://github.com/nodejs/node/pull/34617 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
@@ -313,8 +313,8 @@ class AsyncLocalStorage {
|
||||
}
|
||||
|
||||
getStore() {
|
||||
const resource = executionAsyncResource();
|
||||
if (this.enabled) {
|
||||
const resource = executionAsyncResource();
|
||||
return resource[this.kResourceStore];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user