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

Merge remote branch 'Tim_Smart/retry-loop'

This commit is contained in:
Matt Ranney
2010-09-18 12:04:15 -07:00

View File

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