From c9fc86656e4e528824eca57157215b38fd9834e3 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 Only call executionAsyncResource() in getStore() if the ALS instance is enabled because the resource is not needed otherwise. --- 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]; } }