summaryrefslogtreecommitdiff
path: root/redis/sentinel.py
diff options
context:
space:
mode:
authorBo Lopker <blopker@23andme.com>2015-11-27 08:42:14 -0800
committerBo Lopker <blopker@23andme.com>2015-11-27 08:42:14 -0800
commit8e17aeb414a3acb0ffc44931d430d51303f3482f (patch)
tree790df40f54701d613c0914b0fadb225594e17f56 /redis/sentinel.py
parent16c8af4ef3750110ec1eeb09bd599db1959ea5ef (diff)
downloadredis-py-8e17aeb414a3acb0ffc44931d430d51303f3482f.tar.gz
FIX #651 try next Sentinel node on TimeoutError
Diffstat (limited to 'redis/sentinel.py')
-rw-r--r--redis/sentinel.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/redis/sentinel.py b/redis/sentinel.py
index 3fb89ce..518fec5 100644
--- a/redis/sentinel.py
+++ b/redis/sentinel.py
@@ -4,7 +4,8 @@ import weakref
from redis.client import StrictRedis
from redis.connection import ConnectionPool, Connection
-from redis.exceptions import ConnectionError, ResponseError, ReadOnlyError
+from redis.exceptions import (ConnectionError, ResponseError, ReadOnlyError,
+ TimeoutError)
from redis._compat import iteritems, nativestr, xrange
@@ -211,7 +212,7 @@ class Sentinel(object):
for sentinel_no, sentinel in enumerate(self.sentinels):
try:
masters = sentinel.sentinel_masters()
- except ConnectionError:
+ except (ConnectionError, TimeoutError):
continue
state = masters.get(service_name)
if state and self.check_master_state(state, service_name):
@@ -235,7 +236,7 @@ class Sentinel(object):
for sentinel in self.sentinels:
try:
slaves = sentinel.sentinel_slaves(service_name)
- except (ConnectionError, ResponseError):
+ except (ConnectionError, ResponseError, TimeoutError):
continue
slaves = self.filter_slaves(slaves)
if slaves: