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

Sentinel settings don't work #565

Open
MSMikl opened this issue Jan 27, 2023 · 1 comment
Open

Sentinel settings don't work #565

MSMikl opened this issue Jan 27, 2023 · 1 comment

Comments

@MSMikl
Copy link

MSMikl commented Jan 27, 2023

if 'SENTINELS' in config:
sentinel_kwargs = {
'db': config.get('DB'),
'password': config.get('PASSWORD'),
'socket_timeout': config.get('SOCKET_TIMEOUT'),
}
sentinel_kwargs.update(config.get('CONNECTION_KWARGS', {}))
sentinel = Sentinel(config['SENTINELS'], **sentinel_kwargs)
return sentinel.master_for(
service_name=config['MASTER_NAME'], redis_class=redis_cls,
)

There are couple errors in Sentinel connection creating.

  1. According to official Python redis docs, you should call Sentinel with passing dicitonary to parameter sentinel_kwargs, not parameters from this dict themselves
  2. To make connection work you should pass parameter "password" to sentinel.master_for() method

For my project I just corrected queues.py myself and replaced old queues.py
Correct code below

    if 'SENTINELS' in config:
        sentinel_kwargs = {
            'db': config.get('DB'),
            'password': config.get('PASSWORD'),
            'socket_timeout': config.get('SOCKET_TIMEOUT'),
        }
        sentinel_kwargs.update(config.get('CONNECTION_KWARGS', {}))
        sentinel = Sentinel(config['SENTINELS'], sentinel_kwargs=sentinel_kwargs)
        return sentinel.master_for(
            service_name=config['MASTER_NAME'], redis_class=redis_cls, password=config.get('PASSWORD')
        )
@selwin
Copy link
Collaborator

selwin commented Jun 2, 2023

Do you mind opening a PR for this? I'd like to cut a new release sometime next week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants