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
path: root/config
diff options
context:
space:
mode:
authorPatricio Cano <suprnova32@gmail.com>2016-11-05 01:54:24 +0300
committerPatricio Cano <suprnova32@gmail.com>2016-11-10 20:38:11 +0300
commitb95216aabadb336e4ed8cdc01f69e873f47f10d0 (patch)
treec139f0dc542e178a83a70e2c49ef187099a1606c /config
parent9e2964c15a7d387e46e25c83afa478c12a856d77 (diff)
Allow the Sidekiq queues to throttle and the factor by which to throttle them to be configurable
Diffstat (limited to 'config')
-rw-r--r--config/initializers/sidekiq.rb16
1 files changed, 4 insertions, 12 deletions
diff --git a/config/initializers/sidekiq.rb b/config/initializers/sidekiq.rb
index 6e660a8c026..7cc5e396f98 100644
--- a/config/initializers/sidekiq.rb
+++ b/config/initializers/sidekiq.rb
@@ -1,6 +1,3 @@
-require 'gitlab/current_settings'
-include Gitlab::CurrentSettings
-
# Custom Redis configuration
redis_config_hash = Gitlab::Redis.params
redis_config_hash[:namespace] = Gitlab::Redis::SIDEKIQ_NAMESPACE
@@ -32,16 +29,11 @@ Sidekiq.configure_server do |config|
end
Sidekiq::Cron::Job.load_from_hash! cron_jobs
- # allow it to fail: it may do so when create_from_defaults is executed before migrations are actually done
- begin
- throttling_enabled = current_application_settings.sidekiq_throttling_enabled
- rescue
- throttling_enabled = false
- end
+ if Gitlab::CurrentSettings.sidekiq_throttling_enabled?
+ factor = current_application_settings.sidekiq_throttling_factor
- if throttling_enabled
- { 'project_cache' => 0.1, 'pipeline' => 0.1 }.each do |queue, ratio|
- Sidekiq::Queue[queue].limit = (ratio * Sidekiq.options[:concurrency]).ceil
+ current_application_settings.sidekiq_throttling_queues.each do |queue|
+ Sidekiq::Queue[queue].limit = (factor * Sidekiq.options[:concurrency]).ceil
end
end