cluster: replace forEach with for-of loop

Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
PR-URL: https://github.com/nodejs/node/pull/50317
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
This commit is contained in:
Jérôme Benoit authored and Marco Ippolito committed 2024-06-17 16:25:22 +02:00
1 parent 7dda156872
commit 954d2aded4
2 files changed
+4 -4

No files matched your search

+2 -2
View File
@@ -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();
+2 -2
View File
@@ -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) {