diff --git a/lib/redis/event_handler.js b/lib/redis/event_handler.js index 08d34245..143bbbcc 100644 --- a/lib/redis/event_handler.js +++ b/lib/redis/event_handler.js @@ -39,10 +39,8 @@ exports.connectHandler = function (self) { self._readyCheck(function (err, info) { if (err) { self.flushQueue(new Error('Ready check failed: ' + err.message)); - if (!self.condition.auth && err.message.split(' ')[0] === 'NOAUTH') { - self.silentEmit('error', err); - self.disconnect(true); - } + self.silentEmit('error', err); + self.disconnect(true); } else { self.serverInfo = info; if (self.connector.check(info)) { diff --git a/test/functional/ready_check.js b/test/functional/ready_check.js index 4507d55f..075f4fdc 100644 --- a/test/functional/ready_check.js +++ b/test/functional/ready_check.js @@ -16,4 +16,20 @@ describe('ready_check', function () { }); redis.connect(); }); + + it('should reconnect when info return a error', function (done) { + var redis = new Redis({ + lazyConnect: true, + retryStrategy: function () { + done(); + return; + } + }); + + stub(redis, 'info', function (callback) { + callback(new Error('info error')); + }); + + redis.connect(); + }); });