diff --git a/lib/internal/cluster/child.js b/lib/internal/cluster/child.js index 1bddd3ca0ac103..092e61cdd1f6b0 100644 --- a/lib/internal/cluster/child.js +++ b/lib/internal/cluster/child.js @@ -270,14 +270,14 @@ function _disconnect(primaryInitiated) { } } - handles.forEach((handle) => { + for (const handle of handles.values()) { waitingCount++; if (handle[owner_symbol]) handle[owner_symbol].close(checkWaitingCount); else handle.close(checkWaitingCount); - }); + } handles.clear(); checkWaitingCount(); diff --git a/lib/internal/cluster/primary.js b/lib/internal/cluster/primary.js index 945f440cd19797..107ab258a47e04 100644 --- a/lib/internal/cluster/primary.js +++ b/lib/internal/cluster/primary.js @@ -152,10 +152,10 @@ function removeWorker(worker) { function removeHandlesForWorker(worker) { assert(worker); - handles.forEach((handle, key) => { + for (const { 0: key, 1: handle } of handles) { if (handle.remove(worker)) handles.delete(key); - }); + } } cluster.fork = function(env) {