Skip to content

Commit

Permalink
[reconnect] fixes redis#1138
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandre-abrioux committed May 27, 2020
1 parent 6f5a0c1 commit a373309
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/cluster/index.ts
Expand Up @@ -316,7 +316,7 @@ class Cluster extends EventEmitter {
if (!reconnect) {
this.manuallyClosing = true;
}
if (this.reconnectTimeout) {
if (this.reconnectTimeout && !reconnect) {
clearTimeout(this.reconnectTimeout);
this.reconnectTimeout = null;
debug("Canceled reconnecting attempts");
Expand Down
9 changes: 4 additions & 5 deletions lib/redis/index.ts
Expand Up @@ -278,10 +278,9 @@ Redis.prototype.connect = function (callback) {

this.condition = {
select: options.db,
auth:
options.username
? [options.username, options.password]
: options.password,
auth: options.username
? [options.username, options.password]
: options.password,
subscriber: false,
};

Expand Down Expand Up @@ -380,7 +379,7 @@ Redis.prototype.disconnect = function (reconnect) {
if (!reconnect) {
this.manuallyClosing = true;
}
if (this.reconnectTimeout) {
if (this.reconnectTimeout && !reconnect) {
clearTimeout(this.reconnectTimeout);
this.reconnectTimeout = null;
}
Expand Down

0 comments on commit a373309

Please sign in to comment.