Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions benchmark/async_hooks/async-resource-vs-destroy.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,14 @@ function buildCurrentResource(getServe) {

function getCLS() {
const resource = executionAsyncResource();
if (resource === null || !resource[cls]) {
if (!resource[cls]) {
return null;
}
return resource[cls].state;
}

function setCLS(state) {
const resource = executionAsyncResource();
if (resource === null) {
return;
}
if (!resource[cls]) {
resource[cls] = { state };
} else {
Expand Down Expand Up @@ -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;
}

Expand Down