Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Pechkurov <apechkurov@gmail.com>2020-03-26 15:11:06 +0300
committerBeth Griggs <Bethany.Griggs@uk.ibm.com>2020-04-07 18:25:12 +0300
commita2ff277b6e9f2b248fe66c0ae63121ecee634b6e (patch)
treebd8ceaa6b28bcdbe037b14986f2731662882857a /benchmark
parentfcb302f72ffdb3716905807498e5b9e0a7513f77 (diff)
benchmark: fix error on server close in AsyncLocalStorage benchmark
PR-URL: https://github.com/nodejs/node/pull/32503 Reviewed-By: Vladimir de Turckheim <vlad2t@hotmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Diffstat (limited to 'benchmark')
-rw-r--r--benchmark/async_hooks/async-resource-vs-destroy.js11
1 files changed, 7 insertions, 4 deletions
diff --git a/benchmark/async_hooks/async-resource-vs-destroy.js b/benchmark/async_hooks/async-resource-vs-destroy.js
index 1894e4e8777..d48510d8929 100644
--- a/benchmark/async_hooks/async-resource-vs-destroy.js
+++ b/benchmark/async_hooks/async-resource-vs-destroy.js
@@ -35,7 +35,7 @@ function buildCurrentResource(getServe) {
function getCLS() {
const resource = executionAsyncResource();
- if (resource === null || !resource[cls]) {
+ if (!resource[cls]) {
return null;
}
return resource[cls].state;
@@ -43,9 +43,6 @@ function buildCurrentResource(getServe) {
function setCLS(state) {
const resource = executionAsyncResource();
- if (resource === null) {
- return;
- }
if (!resource[cls]) {
resource[cls] = { state };
} else {
@@ -116,11 +113,17 @@ function buildAsyncLocalStorage(getServe) {
function getCLS() {
const store = asyncLocalStorage.getStore();
+ if (store === undefined) {
+ return null;
+ }
return store.state;
}
function setCLS(state) {
const store = asyncLocalStorage.getStore();
+ if (store === undefined) {
+ return;
+ }
store.state = state;
}