summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSyedTahaA <62918944+SyedTahaA@users.noreply.github.com>2022-11-21 05:57:30 -0500
committerGitHub <noreply@github.com>2022-11-21 12:57:30 +0200
commite425674d84a63762f16d5b44b19aa70119fcd814 (patch)
treead7d4516cee7b448a3d338f7968125b6c3021090
parent59c8e7d05a5cf79c933f0c7e0fef0dfee93b0ed4 (diff)
downloadredis-py-e425674d84a63762f16d5b44b19aa70119fcd814.tar.gz
Fix Sentinel.execute_command to execute across the entire sentinel cluster (#2459)
* Change sentinel execute command to execute across the entire cluster * Add change to CHANGES file
-rw-r--r--CHANGES1
-rw-r--r--redis/sentinel.py4
2 files changed, 3 insertions, 2 deletions
diff --git a/CHANGES b/CHANGES
index 883c548..c0b183e 100644
--- a/CHANGES
+++ b/CHANGES
@@ -28,6 +28,7 @@
* Fixed "cannot pickle '_thread.lock' object" bug (#2354, #2297)
* Added CredentialsProvider class to support password rotation
* Enable Lock for asyncio cluster mode
+ * Fix Sentinel.execute_command doesn't execute across the entire sentinel cluster bug (#2458)
* 4.1.3 (Feb 8, 2022)
* Fix flushdb and flushall (#1926)
diff --git a/redis/sentinel.py b/redis/sentinel.py
index d35abaf..d70b714 100644
--- a/redis/sentinel.py
+++ b/redis/sentinel.py
@@ -200,10 +200,10 @@ class Sentinel(SentinelCommands):
kwargs.pop("once")
if once:
+ random.choice(self.sentinels).execute_command(*args, **kwargs)
+ else:
for sentinel in self.sentinels:
sentinel.execute_command(*args, **kwargs)
- else:
- random.choice(self.sentinels).execute_command(*args, **kwargs)
return True
def __repr__(self):