mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
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:
@@ -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,
|
||||
|
Reference in New Issue
Block a user