镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
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 number Diff line number Diff 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 Down Expand 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 Down Expand Up @@ -615,6 +613,8 @@ function processImmediate() {

emitAfter(asyncId);

runNextTicks();

immediate = immediate._idleNext;
}

Expand Down