From 4b3e9486ca8a3ba53455febbf34760adc71bc16f Mon Sep 17 00:00:00 2001 From: gengjiawen Date: Sun, 10 Mar 2019 12:44:12 +0800 Subject: [PATCH] cluster: refactor empty for in round_robin_handle.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/26560 Reviewed-By: Luigi Pinca Reviewed-By: Ruben Bridgewater Reviewed-By: Michaƫl Zasso Reviewed-By: James M Snell --- lib/internal/cluster/round_robin_handle.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/internal/cluster/round_robin_handle.js b/lib/internal/cluster/round_robin_handle.js index 6b2bc372545cd9..dc27f0de2939e8 100644 --- a/lib/internal/cluster/round_robin_handle.js +++ b/lib/internal/cluster/round_robin_handle.js @@ -73,8 +73,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;