diff --git a/lib/internal/timers.js b/lib/internal/timers.js index bb1888198165fb..4067c2ee0b3165 100644 --- a/lib/internal/timers.js +++ b/lib/internal/timers.js @@ -313,7 +313,7 @@ function insert(item, refed, start) { item._idleStart = start; // Use an existing list if there is one, otherwise we need to make a new one. - var list = timerListMap[msecs]; + let list = timerListMap[msecs]; if (list === undefined) { debug('no %d list was found in insert, creating a new one', msecs); const expiry = start + msecs; @@ -396,7 +396,7 @@ function getTimerCallbacks(runNextTicks) { function processImmediate() { const queue = outstandingQueue.head !== null ? outstandingQueue : immediateQueue; - var immediate = queue.head; + let immediate = queue.head; // Clear the linked list early in case new `setImmediate()` // calls occur while immediate callbacks are executed @@ -482,10 +482,10 @@ function getTimerCallbacks(runNextTicks) { debug('timeout callback %d', msecs); - var diff, timer; let ranAtLeastOneTimer = false; + let timer; while (timer = L.peek(list)) { - diff = now - timer._idleStart; + const diff = now - timer._idleStart; // Check if this loop iteration is too early for the next timer. // This happens if there are more timers scheduled for later in the list.