Skip to content

Commit

Permalink
fix: won't emit error again when password is wrong
Browse files Browse the repository at this point in the history
  • Loading branch information
luin committed May 7, 2016
1 parent 3561fab commit dfdebfe
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/redis/event_handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ exports.connectHandler = function (self) {
self.resetCommandQueue();

// AUTH command should be processed before any other commands
var flushed = false;
if (self.condition.auth) {
self.auth(self.condition.auth, function (err) {
if (err) {
if (err.message.indexOf('no password is set') === -1) {
flushed = true;
self.flushQueue(err);
self.silentEmit('error', err);
self.disconnect(true);
Expand All @@ -38,9 +40,11 @@ exports.connectHandler = function (self) {
if (self.options.enableReadyCheck) {
self._readyCheck(function (err, info) {
if (err) {
self.flushQueue(new Error('Ready check failed: ' + err.message));
self.silentEmit('error', err);
self.disconnect(true);
if (!flushed) {
self.flushQueue(new Error('Ready check failed: ' + err.message));
self.silentEmit('error', err);
self.disconnect(true);
}
} else {
self.serverInfo = info;
if (self.connector.check(info)) {
Expand Down

0 comments on commit dfdebfe

Please sign in to comment.