-
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
Conversation
👍 |
How about emitting an error instead of a "broken" event, then we will get the throw behavior. This won't do anything if nobody is listening for the "broken" event. |
That sounds good to me too, I only went for a special |
Yeah, an "error" with an error something to the effect of |
Sounds good - done, and squashed into single commit. |
…timeout Also documenting the "reconnecting" event
This appears to be an easily-fixed hole in the library. I provide a connection timeout option to the client and I need my program to know when the Redis client has given up; today it cannot know this without regularly inspecting the client object's retry_totaltime property. Please merge this and update in npm. |
this fixes issue #586 |
@@ -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 |
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
This needs a rebase and two small comments otherwise LGTM |
#829 has got this covered, closing this PR |
Also documenting the "reconnecting" event.
Happy to discuss this further, but either way, when working with sharded Redis instances (for instance using https://github.com/blindsey/redis-shard) it's helpful to have some way to know when a Redis server seems to have totally gone down so that we can send out alerts, remove it from the cluster, spin up another server, etc.