Merge pull request #10514 from colinux/redis-timeout
Tech: réduit le connect timeout de redis d'1s à 0.2s
This commit is contained in:
commit
321409eb25
2 changed files with 13 additions and 8 deletions
|
@ -62,17 +62,21 @@ Rails.application.configure do
|
||||||
|
|
||||||
# Use a different cache store in production.
|
# Use a different cache store in production.
|
||||||
if ENV['REDIS_CACHE_URL'].present?
|
if ENV['REDIS_CACHE_URL'].present?
|
||||||
redis_options = { url: ENV['REDIS_CACHE_URL'] }
|
redis_options = {
|
||||||
redis_options[:ssl] = (ENV['REDIS_CACHE_SSL'] == 'enabled')
|
url: ENV['REDIS_CACHE_URL'],
|
||||||
|
connect_timeout: 0.2,
|
||||||
|
error_handler: -> (method:, returning:, exception:) {
|
||||||
|
Sentry.capture_exception exception, level: 'warning',
|
||||||
|
tags: { method: method, returning: returning }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
redis_options[:ssl] = ENV['REDIS_CACHE_SSL'] == 'enabled'
|
||||||
|
|
||||||
if ENV['REDIS_CACHE_SSL_VERIFY_NONE'] == 'enabled'
|
if ENV['REDIS_CACHE_SSL_VERIFY_NONE'] == 'enabled'
|
||||||
redis_options[:ssl_params] = { verify_mode: OpenSSL::SSL::VERIFY_NONE }
|
redis_options[:ssl_params] = { verify_mode: OpenSSL::SSL::VERIFY_NONE }
|
||||||
end
|
end
|
||||||
|
|
||||||
redis_options[:error_handler] = -> (method:, returning:, exception:) {
|
|
||||||
Sentry.capture_exception exception, level: 'warning',
|
|
||||||
tags: { method: method, returning: returning }
|
|
||||||
}
|
|
||||||
|
|
||||||
config.cache_store = :redis_cache_store, redis_options
|
config.cache_store = :redis_cache_store, redis_options
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
redis_shared_options = {
|
redis_shared_options = {
|
||||||
url: ENV['REDIS_CACHE_URL'], # will fallback to default redis url if empty, and won't fail if there is no redis server
|
url: ENV['REDIS_CACHE_URL'], # will fallback to default redis url if empty, and won't fail if there is no redis server
|
||||||
ssl: ENV['REDIS_CACHE_SSL'] == 'enabled'
|
ssl: ENV['REDIS_CACHE_SSL'] == 'enabled',
|
||||||
|
connect_timeout: 0.2
|
||||||
}
|
}
|
||||||
redis_shared_options[:ssl_params] = { verify_mode: OpenSSL::SSL::VERIFY_NONE } if ENV['REDIS_CACHE_SSL_VERIFY_NONE'] == 'enabled'
|
redis_shared_options[:ssl_params] = { verify_mode: OpenSSL::SSL::VERIFY_NONE } if ENV['REDIS_CACHE_SSL_VERIFY_NONE'] == 'enabled'
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue