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

settings for redis sentinel #3266

Merged
merged 3 commits into from May 10, 2018
Merged

settings for redis sentinel #3266

merged 3 commits into from May 10, 2018

Conversation

MarekBleschke
Copy link
Contributor

No description provided.

@MarekBleschke MarekBleschke requested review from mkurek and ar4s May 9, 2018 08:06
REDIS_MASTER_IP = None
REDIS_MASTER_PORT = None

REDIS_SENTINEL_ENABLED = os.environ.get('REDIS_SENTINEL_ENABLED', 'false').lower() == 'true' # noqa: E501
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use str_to_bool here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

REDIS_CONNECTION = {
'HOST': os.environ.get('REDIS_HOST', 'localhost'),
'PORT': os.environ.get('REDIS_PORT', '6379'),
'HOST': REDIS_MASTER_IP if REDIS_MASTER_IP else os.environ.get('REDIS_HOST', 'localhost'), # noqa: E501
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not REDIS_MASTER_IP or os.environ.get('REDIS_HOST', 'localhost')?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you're right, or looks better

@coveralls
Copy link

coveralls commented May 9, 2018

Coverage Status

Coverage remained the same at 84.393% when pulling 6718742 on MarekBleschke:feature/redis_sentinel_cofig into b1fb06b on allegro:ng.


sentinel = Sentinel(
[tuple(s_host.split(':')) for s_host in SENTINEL_HOSTS],
socket_timeout=0.2
Copy link
Contributor

@romcheg romcheg May 9, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it'd be better allow to parameterize this timeout as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

from redis.sentinel import Sentinel

# SENTINEL_HOSTS env variable format: host_1:port;host_2:port
SENTINEL_HOSTS = os.environ['SENTINEL_HOSTS'].split(';')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider naming it REDIS_SENTINEL_HOSTS

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

Copy link
Contributor

@romcheg romcheg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no concerns left. LGTM, thanks!

@MarekBleschke MarekBleschke merged commit a7479ca into allegro:ng May 10, 2018
@MarekBleschke MarekBleschke deleted the feature/redis_sentinel_cofig branch May 10, 2018 09:19
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

Successfully merging this pull request may close these issues.

None yet

5 participants