From 4aa073beb3877cc4c074b7a00fff0eddcf4e80e5 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Mon, 26 Jul 2021 16:18:16 +0300 Subject: [PATCH] Handle unexpected errors from pylibmc --- app/scodoc/sco_cache.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/scodoc/sco_cache.py b/app/scodoc/sco_cache.py index 3a3fdec4a..ecbf80a69 100644 --- a/app/scodoc/sco_cache.py +++ b/app/scodoc/sco_cache.py @@ -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):