diff --git a/index.js b/index.js index c3c3e1ec2b..bf73b5c9e4 100644 --- a/index.js +++ b/index.js @@ -228,8 +228,6 @@ function create_parser (self) { RedisClient.prototype.create_stream = function () { var self = this; - var first_attempt = !this.stream; - // Init parser this.reply_parser = create_parser(this); @@ -308,8 +306,7 @@ RedisClient.prototype.create_stream = function () { this.ready = true; // Fail silently as we might not be able to connect this.auth(this.auth_pass, function (err) { - if (err && first_attempt) { - self.command_queue.get(0).callback = noop; + if (err && err.code !== 'UNCERTAIN_STATE') { self.emit('error', err); } }); diff --git a/test/auth.spec.js b/test/auth.spec.js index 5697c1663b..8411a4b618 100644 --- a/test/auth.spec.js +++ b/test/auth.spec.js @@ -260,10 +260,9 @@ describe('client authentication', function () { password: 'wrong_password', parser: parser }); - client.on('error', function (err) { + client.once('error', function (err) { assert.strictEqual(err.message, 'ERR invalid password'); - // Make sure no other errors are reported - setTimeout(done, 50); + done(); }); });