Skip to content

Commit

Permalink
fix: silence auth errors on reconnect
Browse files Browse the repository at this point in the history
  • Loading branch information
BridgeAR committed Jul 23, 2017
1 parent 42e8bd6 commit 4f7f1ad
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
5 changes: 1 addition & 4 deletions index.js
Expand Up @@ -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);

Expand Down Expand Up @@ -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);
}
});
Expand Down
5 changes: 2 additions & 3 deletions test/auth.spec.js
Expand Up @@ -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();
});
});

Expand Down

0 comments on commit 4f7f1ad

Please sign in to comment.