1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-06 02:15:48 +03:00

Prevent retry loop

This commit is contained in:
Tim-Smart
2010-09-18 15:02:17 +12:00
parent 8e7f1cc1e7
commit b55d7c6f44

View File

@@ -295,6 +295,9 @@ function RedisClient(stream) {
var self = this; var self = this;
this.stream.on("connect", function () { this.stream.on("connect", function () {
if (exports.debug_mode) {
console.log("Stream connected");
}
self.connected = true; self.connected = true;
self.connections += 1; self.connections += 1;
self.command_queue = new Queue(); self.command_queue = new Queue();
@@ -310,6 +313,7 @@ function RedisClient(stream) {
console.log("Redis reply parser error: " + err.stack); console.log("Redis reply parser error: " + err.stack);
}); });
self.retry_timer = null;
self.retry_delay = 250; self.retry_delay = 250;
self.stream.setNoDelay(); self.stream.setNoDelay();
self.stream.setTimeout(0); self.stream.setTimeout(0);
@@ -382,7 +386,6 @@ RedisClient.prototype.connection_gone = function () {
if (exports.debug_mode) { if (exports.debug_mode) {
console.log("Retrying conneciton..."); console.log("Retrying conneciton...");
} }
self.retry_timer = null;
self.retry_delay = self.retry_delay * self.retry_backoff; self.retry_delay = self.retry_delay * self.retry_backoff;
self.stream.destroy(); self.stream.destroy();
self.stream.connect(self.port, self.host); self.stream.connect(self.port, self.host);