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:
parent
c8805b8043
commit
7b2dc79437
@ -270,14 +270,14 @@ function _disconnect(primaryInitiated) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
handles.forEach((handle) => {
|
for (const handle of handles.values()) {
|
||||||
waitingCount++;
|
waitingCount++;
|
||||||
|
|
||||||
if (handle[owner_symbol])
|
if (handle[owner_symbol])
|
||||||
handle[owner_symbol].close(checkWaitingCount);
|
handle[owner_symbol].close(checkWaitingCount);
|
||||||
else
|
else
|
||||||
handle.close(checkWaitingCount);
|
handle.close(checkWaitingCount);
|
||||||
});
|
}
|
||||||
|
|
||||||
handles.clear();
|
handles.clear();
|
||||||
checkWaitingCount();
|
checkWaitingCount();
|
||||||
|
@ -152,10 +152,10 @@ function removeWorker(worker) {
|
|||||||
function removeHandlesForWorker(worker) {
|
function removeHandlesForWorker(worker) {
|
||||||
assert(worker);
|
assert(worker);
|
||||||
|
|
||||||
handles.forEach((handle, key) => {
|
for (const { 0: key, 1: handle } of handles) {
|
||||||
if (handle.remove(worker))
|
if (handle.remove(worker))
|
||||||
handles.delete(key);
|
handles.delete(key);
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cluster.fork = function(env) {
|
cluster.fork = function(env) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user