summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgengjiawen <technicalcute@gmail.com>2019-03-10 12:44:12 +0800
committerRuben Bridgewater <ruben@bridgewater.de>2019-03-14 17:15:30 +0100
commitcba23ed92ae0b76b1e233086cc284824453c6997 (patch)
treeb976569cb071bfcc736fc388bea334a040228cbd
parent9e82ee926aa7f98db6708de869f6628a2fdb9f0a (diff)
downloadnode-new-cba23ed92ae0b76b1e233086cc284824453c6997.tar.gz
cluster: refactor empty for in round_robin_handle.js
PR-URL: https://github.com/nodejs/node/pull/26560 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Michaƫl Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
-rw-r--r--lib/internal/cluster/round_robin_handle.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/internal/cluster/round_robin_handle.js b/lib/internal/cluster/round_robin_handle.js
index 86c7bec738..5a12a61d49 100644
--- a/lib/internal/cluster/round_robin_handle.js
+++ b/lib/internal/cluster/round_robin_handle.js
@@ -79,8 +79,10 @@ RoundRobinHandle.prototype.remove = function(worker) {
if (this.all.size !== 0)
return false;
- for (var handle; handle = this.handles.shift(); handle.close())
- ;
+ for (const handle of this.handles) {
+ handle.close();
+ }
+ this.handles = [];
this.handle.close();
this.handle = null;