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
10 changes: 5 additions & 5 deletions lib/timers.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -244,16 +244,12 @@ function processTimers(now) {
debug('process timer lists %d', now);
nextExpiry = Infinity;

let list, ran;
let list;
while (list = queue.peek()) {
if (list.expiry > now) {
nextExpiry = list.expiry;
return refCount > 0 ? nextExpiry : -nextExpiry;
}
if (ran)
runNextTicks();
else
ran = true;
listOnTimeout(list, now);
}
return 0;
Expand DownExpand Up@@ -300,6 +296,8 @@ function listOnTimeout(list, now) {
tryOnTimeout(timer);

emitAfter(asyncId);

runNextTicks();
}

// If `L.peek(list)` returned nothing, the list was either empty or we have
Expand DownExpand Up@@ -615,6 +613,8 @@ function processImmediate() {

emitAfter(asyncId);

runNextTicks();

immediate = immediate._idleNext;
}

Expand Down