Attempt to fix dispatcher stats thread exception (#13478)

* Attempt to fix dispatcher stats thread exception

* catch both exceptions

* Make it work when redis module does not exist

* fix style
This commit is contained in:
Tony Murray
2021-11-11 22:20:36 -06:00
committed by GitHub
parent ef4654d304
commit 0f8862a747

View File

@@ -26,6 +26,14 @@ try:
except ImportError:
pass
try:
from redis.exceptions import ConnectionError as RedisConnectionError
except ImportError:
class RedisConnectionError(Exception):
pass
logger = logging.getLogger(__name__)
@@ -844,7 +852,7 @@ class Service:
getattr(self.config, worker_type).frequency,
)
)
except pymysql.err.Error:
except (pymysql.err.Error, ConnectionResetError, RedisConnectionError):
logger.critical(
"Unable to log performance statistics - is the database still online?",
exc_info=True,