diff options
author | Paco Guzman <pacoguzmanp@gmail.com> | 2016-10-03 16:42:02 +0200 |
---|---|---|
committer | Paco Guzman <pacoguzmanp@gmail.com> | 2016-10-06 10:50:03 +0200 |
commit | 640a4c88341f790ede78f845d29a37634030581f (patch) | |
tree | 85fde39e674cc395a65bc4d647a700cbefa9619e /lib/gitlab/redis.rb | |
parent | 0bbeff3d5e6c1b5ea3b364f052ed6f777c3aa645 (diff) | |
download | gitlab-ce-640a4c88341f790ede78f845d29a37634030581f.tar.gz |
Use higher size on Gitlab::Redis connection pool on Sidekiq servers
Diffstat (limited to 'lib/gitlab/redis.rb')
-rw-r--r-- | lib/gitlab/redis.rb | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/gitlab/redis.rb b/lib/gitlab/redis.rb index 3faab937726..c649da8c426 100644 --- a/lib/gitlab/redis.rb +++ b/lib/gitlab/redis.rb @@ -24,10 +24,20 @@ module Gitlab end def with - @pool ||= ConnectionPool.new { ::Redis.new(params) } + @pool ||= ConnectionPool.new(size: pool_size) { ::Redis.new(params) } @pool.with { |redis| yield redis } end + def pool_size + if Sidekiq.server? + # the pool will be used in a multi-threaded context + Sidekiq.options[:concurrency] + 5 + else + # probably this is a Unicorn process, so single threaded + 5 + end + end + def _raw_config return @_raw_config if defined?(@_raw_config) |