summaryrefslogtreecommitdiff
path: root/redis/sentinel.py
diff options
context:
space:
mode:
authorAndy McCurdy <andy@andymccurdy.com>2020-06-01 11:41:20 -0700
committerAndy McCurdy <andy@andymccurdy.com>2020-06-01 11:41:20 -0700
commit811cdd0282c0c415a379d882678a5c3f7ab74def (patch)
tree7c64db0c19bae775aa7bf6beef3d95b2fee57754 /redis/sentinel.py
parent6518c0812667b567fca365481366f07a38e0d755 (diff)
downloadredis-py-sentinel-1345.tar.gz
ConnectionPool.disconnect now accepts arg to disconnect only idle connssentinel-1345
When the sentinel's master address is changed, disconnect all idle connections in the pool.
Diffstat (limited to 'redis/sentinel.py')
-rw-r--r--redis/sentinel.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/redis/sentinel.py b/redis/sentinel.py
index bbc4cf5..2b212ea 100644
--- a/redis/sentinel.py
+++ b/redis/sentinel.py
@@ -108,6 +108,9 @@ class SentinelConnectionPool(ConnectionPool):
if self.is_master:
if self.master_address != master_address:
self.master_address = master_address
+ # disconnect any idle connections so that they reconnect
+ # to the new master the next time that they are used.
+ self.disconnect(inuse_connections=False)
return master_address
def rotate_slaves(self):