Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usage of "once" argument is incorrect (inverted) in async Sentinel client #2667

Closed
felipou opened this issue Mar 27, 2023 · 3 comments
Closed
Labels

Comments

@felipou
Copy link
Contributor

felipou commented Mar 27, 2023

I was just taking a look at the source code and saw this, the condition seems inverted:

if once:
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)

In the non-async Sentinel it seems correct:
https://github.com/redis/redis-py/blob/master/redis/sentinel.py#L202-L206

If needed, I can help with a PR (I just need to look at the tests to see if we can create one that would catch this).

@dvora-h
Copy link
Collaborator

dvora-h commented Mar 27, 2023

@felipou Thanks for reporting this! We are always happy to receive PR's contributions, so go for it...

@felipou
Copy link
Contributor Author

felipou commented Apr 21, 2023

Ok! I've just created a PR for this: #2718

@felipou
Copy link
Contributor Author

felipou commented Apr 28, 2023

My PR was merged, so I'm closing this issue! Thanks @dvora-h !

@felipou felipou closed this as completed Apr 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants