Skip to content

Commit e425674

Browse files
authored
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
1 parent 59c8e7d commit e425674

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

CHANGES

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
* Fixed "cannot pickle '_thread.lock' object" bug (#2354, #2297)
2929
* Added CredentialsProvider class to support password rotation
3030
* Enable Lock for asyncio cluster mode
31+
* Fix Sentinel.execute_command doesn't execute across the entire sentinel cluster bug (#2458)
3132

3233
* 4.1.3 (Feb 8, 2022)
3334
* Fix flushdb and flushall (#1926)

redis/sentinel.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -200,10 +200,10 @@ def execute_command(self, *args, **kwargs):
200200
kwargs.pop("once")
201201

202202
if once:
203+
random.choice(self.sentinels).execute_command(*args, **kwargs)
204+
else:
203205
for sentinel in self.sentinels:
204206
sentinel.execute_command(*args, **kwargs)
205-
else:
206-
random.choice(self.sentinels).execute_command(*args, **kwargs)
207207
return True
208208

209209
def __repr__(self):

0 commit comments

Comments
 (0)