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

Emit an error when connection permanently goes down

Closes #724 and #615
This commit is contained in:
Ruben Bridgewater
2015-09-10 12:32:07 +02:00
parent 403bfb0200
commit cd5cfb4a8e
2 changed files with 7 additions and 5 deletions

View File

@@ -463,9 +463,7 @@ RedisClient.prototype.connection_gone = function (why) {
if (this.max_attempts && this.attempts >= this.max_attempts) {
this.retry_timer = null;
// TODO - some people need a "Redis is Broken mode" for future commands that errors immediately, and others
// want the program to exit. Right now, we just log, which doesn't really help in either case.
debug("Couldn't get Redis connection after " + this.max_attempts + " attempts.");
this.emit('error', new Error("Redis connection in broken state: maximum connection attempts exceeded."));
return;
}
@@ -481,8 +479,7 @@ RedisClient.prototype.connection_gone = function (why) {
if (self.connect_timeout && self.retry_totaltime >= self.connect_timeout) {
self.retry_timer = null;
// TODO - engage Redis is Broken mode for future commands, or whatever
debug("Couldn't get Redis connection after " + self.retry_totaltime + "ms.");
this.emit('error', new Error("Redis connection in broken state: connection timeout exceeded."));
return;
}