From 946563b2b2b68d2c9c7bd5349aa8c919d802538e Mon Sep 17 00:00:00 2001 From: Charles Leifer Date: Fri, 13 Sep 2024 11:22:24 -0500 Subject: [PATCH] Also catch TimeoutError when making blocking calls. Refs #813 --- huey/storage.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/huey/storage.py b/huey/storage.py index 22147298..a9add711 100644 --- a/huey/storage.py +++ b/huey/storage.py @@ -24,8 +24,9 @@ except ImportError: from redis import Redis from redis.exceptions import ConnectionError + from redis.exceptions import TimeoutError except ImportError: - ConnectionPool = Redis = ConnectionError = None + ConnectionPool = Redis = ConnectionError = TimeoutError = None from huey.constants import EmptyData from huey.exceptions import ConfigurationError @@ -420,7 +421,7 @@ def dequeue(self): return self.conn.brpop( self.queue_key, timeout=self.read_timeout)[1] - except (ConnectionError, TypeError, IndexError): + except (ConnectionError, TimeoutError, TypeError, IndexError): # Unfortunately, there is no way to differentiate a socket # timing out and a host being unreachable. return None @@ -574,7 +575,7 @@ def dequeue(self): _, res, _ = self.conn.bzpopmin( self.queue_key, timeout=self.read_timeout) - except (ConnectionError, TypeError, IndexError): + except (ConnectionError, TimeoutError, TypeError, IndexError): # Unfortunately, there is no way to differentiate a socket # timing out and a host being unreachable. return