Skip to content

Commit

Permalink
[fixup] restore iff retrieve
Browse files Browse the repository at this point in the history
  • Loading branch information
refack committed Jul 16, 2017
1 parent 8414756 commit 605de08
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/internal/async_hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,14 @@ function triggerAsyncId() {


function triggerIdScopeSync(id, block) {
const old = async_uid_fields[kCurrentTriggerId];
let old = async_uid_fields[kCurrentTriggerId];
async_uid_fields[kCurrentTriggerId] = id;
try {
return block();
const ret = block();
if (async_uid_fields[kCurrentTriggerId] !== id) old = null;
return ret;
} finally {
async_uid_fields[kCurrentTriggerId] = old;
old && (async_uid_fields[kCurrentTriggerId] = old);
}
}

Expand Down

0 comments on commit 605de08

Please sign in to comment.