diff --git a/lib/internal/bootstrap/node.js b/lib/internal/bootstrap/node.js index 93cc085cea8eeae..ba2177f144ad9a1 100644 --- a/lib/internal/bootstrap/node.js +++ b/lib/internal/bootstrap/node.js @@ -42,7 +42,6 @@ const { Array, ArrayPrototypeConcat, ArrayPrototypeFill, - ArrayPrototypeForEach, FunctionPrototypeCall, JSONParse, ObjectDefineProperty, @@ -157,22 +156,21 @@ const rawMethods = internalBinding('process_methods'); process._getActiveHandles = rawMethods._getActiveHandles; process.getActiveResourcesInfo = function() { - var timeoutCount = 0; - ArrayPrototypeForEach(ObjectValues(internalTimers.timerListMap), - (list) => { - var timer = list._idlePrev === list ? - null : list._idlePrev; - while (timer !== null) { - timeoutCount += timer.hasRef(); - timer = timer._idlePrev === list ? - null : timer._idlePrev; - } - }); - - var immediateCount = 0; + let timeoutCount = 0; + const lists = ObjectValues(internalTimers.timerListMap); + for (let i = 0; i < lists.length; ++i) { + const list = lists[i]; + let timer = list._idlePrev; + while (timer !== list) { + timeoutCount += timer.hasRef(); + timer = timer._idlePrev; + } + } + + let immediateCount = 0; const queue = internalTimers.outstandingQueue.head !== null ? internalTimers.outstandingQueue : internalTimers.immediateQueue; - var immediate = queue.head; + let immediate = queue.head; while (immediate !== null) { immediateCount += immediate.hasRef(); immediate = immediate._idleNext;