Skip to content

Commit

Permalink
Also catch TimeoutError when making blocking calls.
Browse files Browse the repository at this point in the history
Refs #813
  • Loading branch information
coleifer committed Sep 13, 2024
1 parent 895f635 commit 946563b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions huey/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 946563b

Please sign in to comment.