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

Update TODO comment for retry thresholds.

This commit is contained in:
Matt Ranney
2011-11-14 20:23:11 -10:00
parent dfd4c51b79
commit 29c408cbf1

View File

@@ -381,11 +381,12 @@ RedisClient.prototype.connection_gone = function (why) {
if (this.max_attempts && this.attempts >= this.max_attempts) { if (this.max_attempts && this.attempts >= this.max_attempts) {
this.retry_timer = null; this.retry_timer = null;
// TODO - engage Redis is Broken mode for future commands // TODO - some people need a "Redis is Broken mode" for future commands that errors immediately, and others
this.emit("not_reconnecting", "Aborting connection attempt: Max attempts " + this.max_attempts + " failed."); // want the program to exit. Right now, we just log, which doesn't really help in either case.
console.error("node_redis: Couldn't get Redis connection after " + this.max_attempts + " attempts.");
return; return;
} }
self.attempts += 1; self.attempts += 1;
self.emit("reconnecting", { self.emit("reconnecting", {
delay: self.retry_delay, delay: self.retry_delay,
@@ -400,11 +401,11 @@ RedisClient.prototype.connection_gone = function (why) {
if (self.connect_timeout && self.retry_totaltime >= self.connect_timeout) { if (self.connect_timeout && self.retry_totaltime >= self.connect_timeout) {
self.retry_timer = null; self.retry_timer = null;
// TODO - engage Redis is Broken mode for future commands // TODO - engage Redis is Broken mode for future commands, or whatever
self.emit("not_reconnecting", "Aborting connection attempt: Total timeout of " + self.connect_timeout + "ms exceeded."); console.error("node_redis: Couldn't get Redis connection after " + self.retry_totaltime + "ms.");
return; return;
} }
self.stream.connect(self.port, self.host); self.stream.connect(self.port, self.host);
self.retry_timer = null; self.retry_timer = null;
}, this.current_retry_delay); }, this.current_retry_delay);