-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Emitting error event when connection permanently goes down #615
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -508,8 +508,10 @@ 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. | ||
// want the program to exit. Right now, we just log, which doesn't really help in either case, and emit | ||
// an error event. | ||
console.error("node_redis: Couldn't get Redis connection after " + this.max_attempts + " attempts."); | ||
this.emit('error', new Error("Redis connection in broken state")); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To distinguish this error from the other one it would be good to use different error messages. E.g.: Redis connection in broken state: maximum connection attempts exceeded." and "Redis connection in broken state: connection timeout exceeded.". And please add a note in the readme about the emitted errors after exceeding the limit. Thx |
||
return; | ||
} | ||
|
||
|
@@ -529,6 +531,7 @@ RedisClient.prototype.connection_gone = function (why) { | |
self.retry_timer = null; | ||
// TODO - engage Redis is Broken mode for future commands, or whatever | ||
console.error("node_redis: Couldn't get Redis connection after " + self.retry_totaltime + "ms."); | ||
this.emit('error', new Error("Redis connection in broken state")); | ||
return; | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove both TODOs including the console.error