Commit 329de0ed authored by Vitaly Lipatov's avatar Vitaly Lipatov

redis: bound CLI and internal connection timeouts

parent 4c671342
...@@ -25,6 +25,7 @@ def redis_connection_options(settings): ...@@ -25,6 +25,7 @@ def redis_connection_options(settings):
options = { options = {
'host': settings.get('redis_server', 'localhost'), 'host': settings.get('redis_server', 'localhost'),
'port': settings.getint('redis_port', 6379), 'port': settings.getint('redis_port', 6379),
'socket_connect_timeout': 5,
'socket_timeout': 5, 'socket_timeout': 5,
} }
username = settings.get('redis_username', '').strip() username = settings.get('redis_username', '').strip()
......
...@@ -47,7 +47,11 @@ def get_redis(): ...@@ -47,7 +47,11 @@ def get_redis():
config = configparser.ConfigParser() config = configparser.ConfigParser()
config.read(CONFIG_PATH) config.read(CONFIG_PATH)
redis_server = config.get('Settings', 'redis_server', fallback='localhost') redis_server = config.get('Settings', 'redis_server', fallback='localhost')
options = {'port': config.getint('Settings', 'redis_port', fallback=6379)} options = {
'port': config.getint('Settings', 'redis_port', fallback=6379),
'socket_connect_timeout': 5,
'socket_timeout': 5,
}
username = config.get('Settings', 'redis_username', fallback='').strip() username = config.get('Settings', 'redis_username', fallback='').strip()
password = config.get('Settings', 'redis_password', fallback='') password = config.get('Settings', 'redis_password', fallback='')
if username: if username:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment