From 6fa2a81bafb760a2dfff9da3358881ade82f6e11 Mon Sep 17 00:00:00 2001 From: James Allen Date: Mon, 24 Oct 2016 16:54:56 +0100 Subject: [PATCH] Make breakout logic after draining N clients more clear --- services/real-time/app/coffee/DrainManager.coffee | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/services/real-time/app/coffee/DrainManager.coffee b/services/real-time/app/coffee/DrainManager.coffee index efdd636199..92b59b0751 100644 --- a/services/real-time/app/coffee/DrainManager.coffee +++ b/services/real-time/app/coffee/DrainManager.coffee @@ -19,7 +19,8 @@ module.exports = logger.log {client_id: client.id}, "Asking client to reconnect gracefully" client.emit "reconnectGracefully" drainedCount++ - if drainedCount == N + haveDrainedNClients = (drainedCount == N) + if haveDrainedNClients break if drainedCount < N logger.log "All clients have been told to reconnectGracefully" \ No newline at end of file