From 493c5d971ca9565207ede7647a9902405c98a2a0 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 --- 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 86c7bec7386ed7..5a12a61d4941ce 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;