Skip to content

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

Closed
@felipou

Description

@felipou

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions