Skip to content

Commit

Permalink
timers: remove domain enter and exit
Browse files Browse the repository at this point in the history
With domains implemented over AsyncHooks, it's no longer
necessary to explicitly enter and exit the domain.

PR-URL: #17880
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Andreas Madsen <[email protected]>
  • Loading branch information
apapirovski authored and MylesBorins committed Jan 9, 2018
1 parent 5df8c76 commit fb640c6
Showing 1 changed file with 0 additions and 17 deletions.
17 changes: 0 additions & 17 deletions lib/timers.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,15 +256,7 @@ function listOnTimeout() {
continue;
}

var domain = timer.domain;
if (domain) {
domain.enter();
}

tryOnTimeout(timer, list);

if (domain)
domain.exit();
}

// If `L.peek(list)` returned nothing, the list was either empty or we have
Expand Down Expand Up @@ -688,31 +680,22 @@ var immediateQueue = new ImmediateList();
function processImmediate() {
var immediate = immediateQueue.head;
var tail = immediateQueue.tail;
var domain;

// Clear the linked list early in case new `setImmediate()` calls occur while
// immediate callbacks are executed
immediateQueue.head = immediateQueue.tail = null;

while (immediate !== null) {
domain = immediate.domain;

if (!immediate._onImmediate) {
immediate = immediate._idleNext;
continue;
}

if (domain)
domain.enter();

// Save next in case `clearImmediate(immediate)` is called from callback
var next = immediate._idleNext;

tryOnImmediate(immediate, tail);

if (domain)
domain.exit();

// If `clearImmediate(immediate)` wasn't called from the callback, use the
// `immediate`'s next item
if (immediate._idleNext !== null)
Expand Down

0 comments on commit fb640c6

Please sign in to comment.