Skip to content

Commit 946563b

Browse files
committed
Also catch TimeoutError when making blocking calls.
Refs #813
1 parent 895f635 commit 946563b

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

huey/storage.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@
2424
except ImportError:
2525
from redis import Redis
2626
from redis.exceptions import ConnectionError
27+
from redis.exceptions import TimeoutError
2728
except ImportError:
28-
ConnectionPool = Redis = ConnectionError = None
29+
ConnectionPool = Redis = ConnectionError = TimeoutError = None
2930

3031
from huey.constants import EmptyData
3132
from huey.exceptions import ConfigurationError
@@ -420,7 +421,7 @@ def dequeue(self):
420421
return self.conn.brpop(
421422
self.queue_key,
422423
timeout=self.read_timeout)[1]
423-
except (ConnectionError, TypeError, IndexError):
424+
except (ConnectionError, TimeoutError, TypeError, IndexError):
424425
# Unfortunately, there is no way to differentiate a socket
425426
# timing out and a host being unreachable.
426427
return None
@@ -574,7 +575,7 @@ def dequeue(self):
574575
_, res, _ = self.conn.bzpopmin(
575576
self.queue_key,
576577
timeout=self.read_timeout)
577-
except (ConnectionError, TypeError, IndexError):
578+
except (ConnectionError, TimeoutError, TypeError, IndexError):
578579
# Unfortunately, there is no way to differentiate a socket
579580
# timing out and a host being unreachable.
580581
return

0 commit comments

Comments
 (0)