Skip to content

Commit

Permalink
Merge pull request #13 from sendbird/fix/exception
Browse files Browse the repository at this point in the history
Handle all kind of exception on brpop_read
  • Loading branch information
dlunch authored Jul 27, 2023
2 parents 23f3a10 + 6115e63 commit fe4f387
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions kombu/transport/redis_cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,8 +351,10 @@ def _brpop_read(self, **options):

try:
resp = self.parse_response(conn, 'BRPOP', **options)
except self.connection_errors:
except:
# We should not throw error on this method to make kombu to continue operation
raise Empty()

conn.client.connection.send_command('BRPOP', conn.key, conn.timeout) # schedule next BRPOP

if resp:
Expand All @@ -364,9 +366,10 @@ def _poll_error(self, cmd, conn, **options):
resp = self.parse_response(conn, 'BRPOP', **options)
if resp:
self.deliver_response(resp)
except self.connection_errors as e:
except Exception:
# We should not throw error on this method to make kombu to continue operation
logger.error('Error while reading from Redis', extra={"e": e, "key": conn.key})
# Error is logged at `parse_response`
pass

self.connection.cycle._unregister(self, self.client, conn, 'BRPOP')

Expand All @@ -381,6 +384,7 @@ def parse_response(self, conn, cmd, **options):
return conn.client.parse_response(conn.client.connection, cmd, **options)
except Exception as e:
logger.error('Error while reading from Redis', extra={"e": e, "key": conn.key})

# Mostly copied from https://github.com/sendbird/redis-py/blob/master/redis/cluster.py#L1173
if isinstance(e, ConnectionError) or isinstance(e, TimeoutError):
try:
Expand Down

0 comments on commit fe4f387

Please sign in to comment.