Browse Source

Catch all possible Redis errors (Fixes #635)

pull/657/head
Miguel Grinberg 4 years ago
parent
commit
6f812ef8e4
No known key found for this signature in database GPG Key ID: 36848B262DF5F06C
  1. 4
      socketio/redis_manager.py

4
socketio/redis_manager.py

@ -78,7 +78,7 @@ class RedisManager(PubSubManager): # pragma: no cover
if not retry: if not retry:
self._redis_connect() self._redis_connect()
return self.redis.publish(self.channel, pickle.dumps(data)) return self.redis.publish(self.channel, pickle.dumps(data))
except redis.exceptions.ConnectionError: except redis.exceptions.RedisError:
if retry: if retry:
logger.error('Cannot publish to redis... retrying') logger.error('Cannot publish to redis... retrying')
retry = False retry = False
@ -97,7 +97,7 @@ class RedisManager(PubSubManager): # pragma: no cover
retry_sleep = 1 retry_sleep = 1
for message in self.pubsub.listen(): for message in self.pubsub.listen():
yield message yield message
except redis.exceptions.ConnectionError: except redis.exceptions.RedisError:
logger.error('Cannot receive from redis... ' logger.error('Cannot receive from redis... '
'retrying in {} secs'.format(retry_sleep)) 'retrying in {} secs'.format(retry_sleep))
connect = True connect = True

Loading…
Cancel
Save