GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — benchmark: fix error on server close in AsyncLocalStorage benchmark · nodejs/node@78b90d9

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • benchmark/async_hooks
    • async-resource-vs-destroy.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎benchmark/async_hooks/async-resource-vs-destroy.js‎

Copy file name to clipboardExpand all lines: benchmark/async_hooks/async-resource-vs-destroy.js
+7-4Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,14 @@ function buildCurrentResource(getServe) {
3535

3636
function getCLS() {
3737
const resource = executionAsyncResource();
38-
if (resource === null || !resource[cls]) {
38+
if (!resource[cls]) {
3939
return null;
4040
}
4141
return resource[cls].state;
4242
}
4343

4444
function setCLS(state) {
4545
const resource = executionAsyncResource();
46-
if (resource === null) {
47-
return;
48-
}
4946
if (!resource[cls]) {
5047
resource[cls] = { state };
5148
} else {
@@ -116,11 +113,17 @@ function buildAsyncLocalStorage(getServe) {
116113

117114
function getCLS() {
118115
const store = asyncLocalStorage.getStore();
116+
if (store === undefined) {
117+
return null;
118+
}
119119
return store.state;
120120
}
121121

122122
function setCLS(state) {
123123
const store = asyncLocalStorage.getStore();
124+
if (store === undefined) {
125+
return;
126+
}
124127
store.state = state;
125128
}
126129

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.