summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorPaco Guzman <pacoguzmanp@gmail.com>2016-09-22 08:38:35 +0200
committerPaco Guzman <pacoguzmanp@gmail.com>2016-09-28 11:14:07 +0200
commit263c7f0bccd4821804bb293df3f45f513c1163b6 (patch)
tree687fbca8e70a1b368c7a39ca7eb354ccf9f46c2a /config
parentf4ded8a80889749d057b077a8e3f3ad45d8ba7b0 (diff)
downloadgitlab-ce-263c7f0bccd4821804bb293df3f45f513c1163b6.tar.gz
Use a ConnectionPool for Rails.cache on Sidekiq servers22364-rails-cache-connection-pool-sidekiq-servers
It’s important to remember that connections on ConnectionPool are created when needed so if modify the objects later to create those connections weird things could happen https://gitlab.com/gitlab-com/infrastructure/issues/464#note_15850653
Diffstat (limited to 'config')
-rw-r--r--config/application.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/config/application.rb b/config/application.rb
index 4792f6670a8..8166b6003f6 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -116,6 +116,10 @@ module Gitlab
redis_config_hash = Gitlab::Redis.params
redis_config_hash[:namespace] = Gitlab::Redis::CACHE_NAMESPACE
redis_config_hash[:expires_in] = 2.weeks # Cache should not grow forever
+ if Sidekiq.server? # threaded context
+ redis_config_hash[:pool_size] = Sidekiq.options[:concurrency] + 5
+ redis_config_hash[:pool_timeout] = 1
+ end
config.cache_store = :redis_store, redis_config_hash
config.active_record.raise_in_transactional_callbacks = true