mirror of
https://github.com/apache/superset.git
synced 2024-09-12 08:39:45 -04:00
Make sure cache.set never fails hard (#611)
This commit is contained in:
parent
9ed8c32f76
commit
267c0191a8
@ -261,7 +261,12 @@ class BaseViz(object):
|
||||
payload['cached_dttm'] = datetime.now().isoformat().split('.')[0]
|
||||
logging.info("Caching for the next {} seconds".format(
|
||||
cache_timeout))
|
||||
cache.set(cache_key, payload, timeout=cache_timeout)
|
||||
try:
|
||||
cache.set(cache_key, payload, timeout=cache_timeout)
|
||||
except Exception as e:
|
||||
# cache.set call can fail if the backend is down or if
|
||||
# the key is too large or whatever other reasons
|
||||
logging.warning("Could not cache key {}".format(cache_key))
|
||||
payload['is_cached'] = is_cached
|
||||
return self.json_dumps(payload)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user