From 313fd7f65be2866c01e967310d6ddb3bad15dfa2 Mon Sep 17 00:00:00 2001 From: William Hockey Date: Thu, 12 Dec 2013 12:05:38 -0800 Subject: [PATCH] only re-initializing retry variables if the connection is really connected --- index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index aed785618c..0ea2312377 100644 --- a/index.js +++ b/index.js @@ -229,6 +229,8 @@ RedisClient.prototype.do_auth = function () { // now we are really connected self.emit("connect"); + self.initialize_retry_vars(); + if (self.options.no_ready_check) { self.on_ready(); } else { @@ -248,7 +250,6 @@ RedisClient.prototype.on_connect = function () { this.connections += 1; this.command_queue = new Queue(); this.emitted_end = false; - this.initialize_retry_vars(); if (this.options.socket_nodelay) { this.stream.setNoDelay(); } @@ -260,6 +261,7 @@ RedisClient.prototype.on_connect = function () { this.do_auth(); } else { this.emit("connect"); + this.initialize_retry_vars(); if (this.options.no_ready_check) { this.on_ready();