summaryrefslogtreecommitdiff
path: root/redis
diff options
context:
space:
mode:
authorFelipe Machado <462154+felipou@users.noreply.github.com>2023-04-27 11:17:17 -0300
committerGitHub <noreply@github.com>2023-04-27 17:17:17 +0300
commitd6bb4573618672d525c84877ec69827ff975299f (patch)
tree3370e150820edc03877634be7cf4396acf7d1520 /redis
parent7fc4c76c778163c21d396f99dcc710d99942895f (diff)
downloadredis-py-d6bb4573618672d525c84877ec69827ff975299f.tar.gz
Fix incorrect usage of once flag in async Sentinel (#2718)
In the execute_command of the async Sentinel, the once flag was being used incorrectly, with its meaning inverted. To fix we just needed to invert the if and else bodies. This isn't being caught by the tests currently because the tests of commands that use this flag do not check their results/effects (for example the "test_ckquorum" test).
Diffstat (limited to 'redis')
-rw-r--r--redis/asyncio/sentinel.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/redis/asyncio/sentinel.py b/redis/asyncio/sentinel.py
index ec17886..c3c0f91 100644
--- a/redis/asyncio/sentinel.py
+++ b/redis/asyncio/sentinel.py
@@ -220,13 +220,13 @@ class Sentinel(AsyncSentinelCommands):
kwargs.pop("once")
if once:
+ await random.choice(self.sentinels).execute_command(*args, **kwargs)
+ else:
tasks = [
asyncio.Task(sentinel.execute_command(*args, **kwargs))
for sentinel in self.sentinels
]
await asyncio.gather(*tasks)
- else:
- await random.choice(self.sentinels).execute_command(*args, **kwargs)
return True
def __repr__(self):