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

Catch cache errors and raise errors where necessary #399

Open
jaywhy13 opened this issue Jun 8, 2021 · 2 comments
Open

Catch cache errors and raise errors where necessary #399

jaywhy13 opened this issue Jun 8, 2021 · 2 comments

Comments

@jaywhy13
Copy link

jaywhy13 commented Jun 8, 2021

Waffle currently tries to retrieve a setting from the cache, then goes to the DB if there is a cache miss. This doesn't account for issues accessing the cache. If there is a cache issue (e.g. a TimeoutError), this error is thrown to the caller. In prod, we've encountered several of these issues for a small percentage of our traffic.

I'd suggest making the following changes:

  • By default, catch exceptions thrown by the cache and go directly to the database.
  • Add a setting that allows the dev to configure the number of retries.
  • Allow the dev to configure the number of retries when calling each function (e.g. switch_is_active)
@RenDelaCruz
Copy link

We're facing the exact same problem. If the cache is not available, there's no way for waffle to go directly to the DB.

This #350 (comment) is a possible solution to always read from the DB, but it will hurt performance. It looks like going to the DB upon cache failures by default is a good idea.

@clintonb
Copy link
Collaborator

I'm happy to review a PR if folks want to implement these changes.

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

No branches or pull requests

3 participants