From e45c68af27b0f253baaa9a1f17321edbab9db377 Mon Sep 17 00:00:00 2001 From: Gerhard Stoebich <18708370+Flarna@users.noreply.github.com> Date: Mon, 3 Aug 2020 23:52:58 +0200 Subject: [PATCH] async_hooks: don't read resource if ALS is disabled MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-By: Michaƫl Zasso Reviewed-By: James M Snell Reviewed-By: Luigi Pinca --- lib/async_hooks.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/async_hooks.js b/lib/async_hooks.js index 9e287405f8af0b..320d94b4b15bcf 100644 --- a/lib/async_hooks.js +++ b/lib/async_hooks.js @@ -280,8 +280,8 @@ class AsyncLocalStorage { } getStore() { - const resource = executionAsyncResource(); if (this.enabled) { + const resource = executionAsyncResource(); return resource[this.kResourceStore]; } }