From 6f812ef8e4b86db8d15fcc9a4d79b721fe7ca068 Mon Sep 17 00:00:00 2001 From: Miguel Grinberg Date: Sun, 21 Feb 2021 23:35:05 +0000 Subject: [PATCH] Catch all possible Redis errors (Fixes #635) --- socketio/redis_manager.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/socketio/redis_manager.py b/socketio/redis_manager.py index 4adb1ba..7e99d31 100644 --- a/socketio/redis_manager.py +++ b/socketio/redis_manager.py @@ -78,7 +78,7 @@ class RedisManager(PubSubManager): # pragma: no cover if not retry: self._redis_connect() return self.redis.publish(self.channel, pickle.dumps(data)) - except redis.exceptions.ConnectionError: + except redis.exceptions.RedisError: if retry: logger.error('Cannot publish to redis... retrying') retry = False @@ -97,7 +97,7 @@ class RedisManager(PubSubManager): # pragma: no cover retry_sleep = 1 for message in self.pubsub.listen(): yield message - except redis.exceptions.ConnectionError: + except redis.exceptions.RedisError: logger.error('Cannot receive from redis... ' 'retrying in {} secs'.format(retry_sleep)) connect = True