From 19ea518b36ae55cef8fc9630e74df8974566e886 Mon Sep 17 00:00:00 2001 From: Ruben Bridgewater Date: Tue, 1 Mar 2016 16:58:42 +0100 Subject: [PATCH] Do not emit ready if the slave is still syncing with master / master being down --- index.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index ba2a78e02c..d5c0c0169d 100644 --- a/index.js +++ b/index.js @@ -389,9 +389,15 @@ RedisClient.prototype.on_info_cmd = function (err, res) { } if (!this.server_info.loading || this.server_info.loading === '0') { - debug('Redis server ready.'); - this.on_ready(); - return; + // If the master_link_status exists but the link is not up, try again after 50 ms + if (this.server_info.master_link_status && this.server_info.master_link_status !== 'up') { + this.server_info.loading_eta_seconds = 0.05; + } else { + // Eta loading should change + debug('Redis server ready.'); + this.on_ready(); + return; + } } var retry_time = +this.server_info.loading_eta_seconds * 1000;