Skip to content

Commit 11e9789

Browse files
jerome-benoittargos
authored andcommitted
cluster: replace forEach with for-of loop
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com> PR-URL: #50317 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
1 parent c676e52 commit 11e9789

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/internal/cluster/child.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -270,14 +270,14 @@ function _disconnect(primaryInitiated) {
270270
}
271271
}
272272

273-
handles.forEach((handle) => {
273+
for (const handle of handles.values()) {
274274
waitingCount++;
275275

276276
if (handle[owner_symbol])
277277
handle[owner_symbol].close(checkWaitingCount);
278278
else
279279
handle.close(checkWaitingCount);
280-
});
280+
}
281281

282282
handles.clear();
283283
checkWaitingCount();

lib/internal/cluster/primary.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -152,10 +152,10 @@ function removeWorker(worker) {
152152
function removeHandlesForWorker(worker) {
153153
assert(worker);
154154

155-
handles.forEach((handle, key) => {
155+
for (const { 0: key, 1: handle } of handles) {
156156
if (handle.remove(worker))
157157
handles.delete(key);
158-
});
158+
}
159159
}
160160

161161
cluster.fork = function(env) {

0 commit comments

Comments
 (0)