From 37560d35e4ca833f8b86ba861dc659a163232c09 Mon Sep 17 00:00:00 2001 From: Sarah Mount Date: Fri, 17 Nov 2023 18:01:23 +0000 Subject: [PATCH] Set CACHEOPS_DEGRADE_ON_FAILURE to True 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 --- app/config/settings/base.py | 1 + 1 file changed, 1 insertion(+) diff --git a/app/config/settings/base.py b/app/config/settings/base.py index 4eb0bef4..74bcfda3 100644 --- a/app/config/settings/base.py +++ b/app/config/settings/base.py @@ -369,6 +369,7 @@ CACHEOPS_ENABLED = True CACHEOPS_LRU = True +CACHEOPS_DEGRADE_ON_FAILURE = True CACHEOPS_REDIS = { "host": REDIS_HOST,