Skip to content

Commit 19ea518

Browse files
author
Ruben Bridgewater
committed
Do not emit ready if the slave is still syncing with master / master being down
1 parent 89209b8 commit 19ea518

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

index.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -389,9 +389,15 @@ RedisClient.prototype.on_info_cmd = function (err, res) {
389389
}
390390

391391
if (!this.server_info.loading || this.server_info.loading === '0') {
392-
debug('Redis server ready.');
393-
this.on_ready();
394-
return;
392+
// If the master_link_status exists but the link is not up, try again after 50 ms
393+
if (this.server_info.master_link_status && this.server_info.master_link_status !== 'up') {
394+
this.server_info.loading_eta_seconds = 0.05;
395+
} else {
396+
// Eta loading should change
397+
debug('Redis server ready.');
398+
this.on_ready();
399+
return;
400+
}
395401
}
396402

397403
var retry_time = +this.server_info.loading_eta_seconds * 1000;

0 commit comments

Comments
 (0)