You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-07 13:22:56 +03:00
fix: silence auth errors on reconnect
This commit is contained in:
5
index.js
5
index.js
@@ -228,8 +228,6 @@ function create_parser (self) {
|
|||||||
RedisClient.prototype.create_stream = function () {
|
RedisClient.prototype.create_stream = function () {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
var first_attempt = !this.stream;
|
|
||||||
|
|
||||||
// Init parser
|
// Init parser
|
||||||
this.reply_parser = create_parser(this);
|
this.reply_parser = create_parser(this);
|
||||||
|
|
||||||
@@ -308,8 +306,7 @@ RedisClient.prototype.create_stream = function () {
|
|||||||
this.ready = true;
|
this.ready = true;
|
||||||
// Fail silently as we might not be able to connect
|
// Fail silently as we might not be able to connect
|
||||||
this.auth(this.auth_pass, function (err) {
|
this.auth(this.auth_pass, function (err) {
|
||||||
if (err && first_attempt) {
|
if (err && err.code !== 'UNCERTAIN_STATE') {
|
||||||
self.command_queue.get(0).callback = noop;
|
|
||||||
self.emit('error', err);
|
self.emit('error', err);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@@ -260,10 +260,9 @@ describe('client authentication', function () {
|
|||||||
password: 'wrong_password',
|
password: 'wrong_password',
|
||||||
parser: parser
|
parser: parser
|
||||||
});
|
});
|
||||||
client.on('error', function (err) {
|
client.once('error', function (err) {
|
||||||
assert.strictEqual(err.message, 'ERR invalid password');
|
assert.strictEqual(err.message, 'ERR invalid password');
|
||||||
// Make sure no other errors are reported
|
done();
|
||||||
setTimeout(done, 50);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user