We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c80cff0 commit d5f95a1Copy full SHA for d5f95a1
ordering/caching.py
@@ -6,10 +6,15 @@
6
7
from ordering.settings import REDIS_URL
8
9
-
10
-cache = Redis.from_url(REDIS_URL)
11
logger = getLogger(__name__)
12
+try:
+ cache = Redis.from_url(REDIS_URL)
13
+except ValueError:
14
+ logger.warning("Unable to open cache. Caching will be disabled.", exc_info=True)
15
+ cache = None
16
+
17
18
19
def serialized_response(response):
20
def handle_bytes(value):
@@ -23,6 +28,10 @@ def handle_bytes(value):
23
28
24
29
def safe_cache_content(timeout=None, backup=False, hash_args=False):
25
30
def decorator(func):
31
32
+ if cache is None:
33
+ return func
34
26
35
@wraps(func)
27
36
def wrapper(*args, **kwargs):
37
inputs = f'{args}-{kwargs}'
0 commit comments