-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Detect failover from +switch-master messages #1328
Conversation
@@ -39,6 +41,7 @@ export interface ISentinelConnectionOptions extends ITcpConnectionOptions { | |||
sentinelPassword?: string; | |||
sentinels: Array<Partial<ISentinelAddress>>; | |||
sentinelRetryStrategy?: (retryAttempts: number) => number | void | null; | |||
sentinelReconnectStrategy?: (retryAttempts: number) => number | void | null; |
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.
Not sure about this name, could be confusing.
But I'm planning to submit a PR that documents all the sentinel options after this gets merged, so that might help.
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.
Impressive! The code looks nice! I left two suggestions, lmk your thoughts. Otherwise LGTM!
I made the suggested changes and the code got much simpler 😄 |
Thanks @mjomble! I just invited you as a collaborator so from now on you'll be able to approve and merge others' pull requests (which will automatically publish a new version). Feel free to participate anytime when you have time! |
# [4.27.0](v4.26.0...v4.27.0) (2021-04-24) ### Features * **sentinel:** detect failover from +switch-master messages ([#1328](#1328)) ([a464151](a464151))
🎉 This PR is included in version 4.27.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
# [4.27.0](redis/ioredis@v4.26.0...v4.27.0) (2021-04-24) ### Features * **sentinel:** detect failover from +switch-master messages ([#1328](redis/ioredis#1328)) ([a464151](redis/ioredis@a464151))
Fixes #1314
While working on this, I forgot about the
lastActiveSentinel
suggestion from the other issue. At this point, I'm not sure if it's needed, but I can still add it if it is.I've tested this with various failure scenarios in a Docker cluster and it successfully reconnected in all of them. I also simulated many of the scenarios in new test cases.