mirror of
https://github.com/nodejs/node.git
synced 2026-11-30 11:55:44 -05:00
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:
1 parent
7dda156872
commit
954d2aded4
2 files changed
+4
-4
No files matched your search
@@ -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();
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in new issue
Block a user