timers: remove domain enter and exit
With domains implemented over AsyncHooks, it's no longer necessary to explicitly enter and exit the domain. PR-URL: https://github.com/nodejs/node/pull/17880 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Andreas Madsen <amwebdk@gmail.com>
This commit is contained in:
parent
cfca536d8f
commit
2c94424a0d
@ -256,15 +256,7 @@ function listOnTimeout() {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
var domain = timer.domain;
|
|
||||||
if (domain) {
|
|
||||||
domain.enter();
|
|
||||||
}
|
|
||||||
|
|
||||||
tryOnTimeout(timer, list);
|
tryOnTimeout(timer, list);
|
||||||
|
|
||||||
if (domain)
|
|
||||||
domain.exit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If `L.peek(list)` returned nothing, the list was either empty or we have
|
// If `L.peek(list)` returned nothing, the list was either empty or we have
|
||||||
@ -641,31 +633,22 @@ var immediateQueue = new ImmediateList();
|
|||||||
function processImmediate() {
|
function processImmediate() {
|
||||||
var immediate = immediateQueue.head;
|
var immediate = immediateQueue.head;
|
||||||
var tail = immediateQueue.tail;
|
var tail = immediateQueue.tail;
|
||||||
var domain;
|
|
||||||
|
|
||||||
// Clear the linked list early in case new `setImmediate()` calls occur while
|
// Clear the linked list early in case new `setImmediate()` calls occur while
|
||||||
// immediate callbacks are executed
|
// immediate callbacks are executed
|
||||||
immediateQueue.head = immediateQueue.tail = null;
|
immediateQueue.head = immediateQueue.tail = null;
|
||||||
|
|
||||||
while (immediate !== null) {
|
while (immediate !== null) {
|
||||||
domain = immediate.domain;
|
|
||||||
|
|
||||||
if (!immediate._onImmediate) {
|
if (!immediate._onImmediate) {
|
||||||
immediate = immediate._idleNext;
|
immediate = immediate._idleNext;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (domain)
|
|
||||||
domain.enter();
|
|
||||||
|
|
||||||
// Save next in case `clearImmediate(immediate)` is called from callback
|
// Save next in case `clearImmediate(immediate)` is called from callback
|
||||||
var next = immediate._idleNext;
|
var next = immediate._idleNext;
|
||||||
|
|
||||||
tryOnImmediate(immediate, tail);
|
tryOnImmediate(immediate, tail);
|
||||||
|
|
||||||
if (domain)
|
|
||||||
domain.exit();
|
|
||||||
|
|
||||||
// If `clearImmediate(immediate)` wasn't called from the callback, use the
|
// If `clearImmediate(immediate)` wasn't called from the callback, use the
|
||||||
// `immediate`'s next item
|
// `immediate`'s next item
|
||||||
if (immediate._idleNext !== null)
|
if (immediate._idleNext !== null)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user