Handle unexpected errors from pylibmc

This commit is contained in:
Emmanuel Viennet 2021-07-26 16:18:16 +03:00
parent 84c72fcb50
commit 4aa073beb3

View File

@ -55,7 +55,9 @@
#
import time
import traceback
import pylibmc
from flask import g
from app.scodoc import notesdb as ndb
@ -80,7 +82,12 @@ class ScoDocCache:
@classmethod
def get(cls, oid):
"""Returns cached evaluation, or None"""
return CACHE.get(cls._get_key(oid))
try:
return CACHE.get(cls._get_key(oid))
except pylibmc.Error:
log("Warning: memcached error")
log(traceback.format_exc())
return None
@classmethod
def set(cls, oid, value):