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

PSERV-1561 - Reconnect when readonly error is received from redis in Limitr client #37

Merged
merged 2 commits into from
Mar 7, 2023

Conversation

okeefem3
Copy link

@okeefem3 okeefem3 commented Mar 3, 2023

Description

Adding a reconnectOnError handler for ioredis client that will reconnect if an error is emitted from the client that includes READONLY in the message.
This is important for environments where auto failover is not enabled to minimize incidents in limitr use cases when a failover does occur with an elasticache cluster.

This mimics the behavior used in belgrano.

References

https://auth0team.atlassian.net/browse/PSERV-1561
https://github.com/auth0/belgrano/blob/62589d1e1d31ed5e91ea92a68c8a9b4da5fffc23/lib/cache/redis.js#L58-L63
https://github.com/luin/ioredis#reconnect-on-error

Testing

  • This change adds test coverage for new/changed/fixed functionality

Checklist

  • I have added documentation for new/changed functionality in this PR or in auth0.com/docs
  • All active GitHub checks for tests, formatting, and security are passing
  • The correct base branch is being used, if not the default branch

@okeefem3 okeefem3 marked this pull request as ready for review March 3, 2023 20:44
@okeefem3 okeefem3 requested a review from a team as a code owner March 3, 2023 20:44
@okeefem3
Copy link
Author

okeefem3 commented Mar 3, 2023

Tests run locally are passing ✅

Copy link

@kampde kampde left a comment

Choose a reason for hiding this comment

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

Approving with a comment (fine if you apply it, fine if you don't) but make sure that merged/squashed commit:

  • mentions jira issue in the subject of the commit
  • mentions updating ioredis version somewhere

the docs uses `includes` rather than `indexOf`

Co-authored-by: Carlos Campderrós <carlos@campderros.com>
@okeefem3 okeefem3 changed the title Reconnect when readonly error is received PSERV-1561 - Reconnect when readonly error is received from redis in Limitr client Mar 6, 2023
@@ -15,7 +15,7 @@
"dependencies": {
"async": "^2.6.1",
"disyuntor": "^3.5.0",
"ioredis": "^4.5.1",
"ioredis": "^4.28.5",
Copy link
Member

Choose a reason for hiding this comment

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

This is not a huge change. What's the changelog is saying here?

Copy link
Author

Choose a reason for hiding this comment

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

https://github.com/luin/ioredis/compare/v4.5.1..v4.28.5#diff-c275fec9c453c2a42515bc5ab47e30fa4130ff1426aef2f6e000a9a34e122cb8R1

Mostly bug fixes!
Most feature changes are small, I do not see any red or salmon colored flags, PTAL though and lmk if anything stands out to you.

@joseluisdiaz joseluisdiaz merged commit 4924906 into master Mar 7, 2023
@okeefem3 okeefem3 deleted the PSERV-1561_reconnect_on_readonly_error branch March 7, 2023 17:20
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.

3 participants