Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaco Guzman <pacoguzmanp@gmail.com>2016-10-03 17:42:02 +0300
committerPaco Guzman <pacoguzmanp@gmail.com>2016-10-06 11:50:03 +0300
commit640a4c88341f790ede78f845d29a37634030581f (patch)
tree85fde39e674cc395a65bc4d647a700cbefa9619e /lib/gitlab/redis.rb
parent0bbeff3d5e6c1b5ea3b364f052ed6f777c3aa645 (diff)
Use higher size on Gitlab::Redis connection pool on Sidekiq servers
Diffstat (limited to 'lib/gitlab/redis.rb')
-rw-r--r--lib/gitlab/redis.rb12
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)