Skip to content
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

fix: report error on Sentinel connection refused (#445) #446

Merged
merged 5 commits into from
Apr 16, 2017

Conversation

SamBergeron
Copy link
Contributor

@SamBergeron SamBergeron commented Mar 31, 2017

This is a quick fix to report on a sentinel cluster not being able to connect.
This will also report retries in redis.on('end', ... for subsequent retries of the Sentinel cluster, this behavior is similar to what happens on a failed connection with a single redis instance.
This is the quickest fix I could think of.

if (lastError) {
error += ' Last error: ' + lastError.message;
}
return callback(new Error(error));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't callback() with an error here when we still keep retrying since a callback must not be called more than once.

Instead, what about just emit an event (like "sentinelError") when all sentinels are unreachable just like when a connection to a standalone Redis server is down.

@SamBergeron
Copy link
Contributor Author

Added a callback to silentEmit so that if none of the sentinels can connect we report an error, also added sentinelError reports to know which of the individual sentinels aren't connection if you're listening for that.

@SamBergeron
Copy link
Contributor Author

Just following up on this? Thoughts @luin ?

@luin luin merged commit 286a5bc into redis:master Apr 16, 2017
@luin
Copy link
Collaborator

luin commented Apr 16, 2017

Sorry for the delay. Merged and released with v3.0.0-1! 🍻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants