Configurable Redis timeouts: connect_timeout, read_timeout, write_timeout #8439

pull/8535/head
Juan Ignacio Sánchez Lara 8 years ago
parent 9b30c5a612
commit 702db391aa

@ -7,6 +7,7 @@ ghost tables, importing common data and automatic index creation.
### Features
* Automatic creation of indexes on columns affected by a widget
* Viewer users for organizations.
* Configurable Redis timeouts: connect_timeout, read_timeout, write_timeout. All three default to existing timeout parameter if missing, and 2, 3, 5 it timeout isn't set either.
### Bug Fixes
* Incorrect error message when password validation failed

@ -143,7 +143,9 @@ defaults: &defaults
redis:
host: '127.0.0.1'
port: 6379
timeout: 20
connect_timeout: 2
read_timeout: 3
write_timeout: 5
databases:
tables_metadata: 0
api_credentials: 3

@ -10,9 +10,9 @@ class RedisFactory
# TODO: because of #8439 we're testing different Redis timeouts for connection, R and W.
# After getting a final solution timeout configuration should be read from the file again
redis_conf = conf.select { |k, _| [:host, :port, :driver, :tcp_keepalive, :connect_timeout, :read_timeout, :write_timeout].include?(k) }
redis_conf[:connect_timeout] = 2
redis_conf[:read_timeout] = 3
redis_conf[:write_timeout] = 5
redis_conf[:connect_timeout] = conf.fetch(:timeout, 2) unless redis_conf[:connect_timeout]
redis_conf[:read_timeout] = conf.fetch(:timeout, 3) unless redis_conf[:read_timeout]
redis_conf[:write_timeout] = conf.fetch(:timeout, 5) unless redis_conf[:write_timeout]
if ENV['REDIS_PORT']
redis_conf[:port] = ENV['REDIS_PORT']

Loading…
Cancel
Save