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

Cache errors on views fails the whole view #59

Open
ottusp opened this issue Jul 27, 2024 · 0 comments
Open

Cache errors on views fails the whole view #59

ottusp opened this issue Jul 27, 2024 · 0 comments

Comments

@ottusp
Copy link
Contributor

ottusp commented Jul 27, 2024

Context

@cache_response decorator is used to apply cache to view sets. Usually, attempts to fetch cached data is a "nice to have" to any view call in terms of performance. Therefore, any error on cache should not fail the view call. Instead, a more resilient approach is to ignore cache on errors, and proceed to usual view call.

Issue

When an error occurs on cache layer, it is propagated to the application layer without giving the chance for upstream code to catch it and proceed with whatever approach it wants to - be that log the error, raise a new exception or simply run the view action normally without cache.

Suggestions

  • Add the behavior for cache_response to proceed with view action call when cache call fails;
  • Add the option to call a handler when a cache error occur.
ottusp added a commit to ottusp/drf-toolkit that referenced this issue Jul 27, 2024
When cache fails, exceptions were not captured, so the whole view call would fail.

Since a cache hit attempt is an optional feature (it just saves performance), ignoring cache on cache errors is a more resilient approach.

Closes flamingo-run#59
ottusp added a commit to ottusp/drf-toolkit that referenced this issue Jul 27, 2024
When cache fails, exceptions were not captured, so the whole view call would fail.

Since a cache hit attempt is an optional feature (it just saves performance), ignoring cache on cache errors is a more resilient approach.

Closes flamingo-run#59
@ottusp ottusp changed the title Cache on Views has fallback for errors Cache errors on views fails the whole view Jul 27, 2024
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

1 participant