Skip to content

Commit

Permalink
Set CACHEOPS_DEGRADE_ON_FAILURE to True
Browse files Browse the repository at this point in the history
This commit is a follow-up to Incident 152 (and 95).

Currently, the app fails with HTTP 5xx errors if the associated
Redis cache is unreachable or cannot be used.

This commit sets the `CACHEOPS_DEGRADE_ON_FAILURE` environment
variable to be `True`. This env var instructs django-cacheops
to wrap Redis calls in a try/except block and to handle
connection errors and timeout errors gracefully, by writing
a warning to the logs, rather than letting the relevant
exception propagate up the stack.

See:
    https://github.com/Suor/django-cacheops#setup
    https://github.com/Suor/django-cacheops/blob/master/cacheops/redis.py#L12-L22
  • Loading branch information
snim2 committed Nov 20, 2023
1 parent f8f6007 commit 24ec9c6
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions app/config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,7 @@

CACHEOPS_ENABLED = True
CACHEOPS_LRU = True
CACHEOPS_DEGRADE_ON_FAILURE = True

CACHEOPS_REDIS = {
"host": REDIS_HOST,
Expand Down

0 comments on commit 24ec9c6

Please sign in to comment.