Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 11e9789

Browse filesBrowse 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
Copy full SHA for 11e9789

File tree

Expand file treeCollapse file tree

2 files changed

+4
-4
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+4
-4
lines changed
Open diff view settings
Collapse file

‎lib/internal/cluster/child.js‎

Copy file name to clipboardExpand all lines: lib/internal/cluster/child.js
+2-2Lines changed: 2 additions & 2 deletions
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();
Collapse file

‎lib/internal/cluster/primary.js‎

Copy file name to clipboardExpand all lines: lib/internal/cluster/primary.js
+2-2Lines changed: 2 additions & 2 deletions
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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.