diff options
author | Patricio Cano <suprnova32@gmail.com> | 2016-11-10 11:36:52 -0600 |
---|---|---|
committer | Patricio Cano <suprnova32@gmail.com> | 2016-11-11 11:14:58 -0600 |
commit | e840749b84ceb226e46ebdfb489c735e3370cff7 (patch) | |
tree | 54026ef9b905cdbfad9d6aee9320f0f530c4dd09 /lib | |
parent | 208530494e5d2c5c62a3e1c24489aae0e4935e3a (diff) | |
download | gitlab-ce-e840749b84ceb226e46ebdfb489c735e3370cff7.tar.gz |
Refactored Sidekiq Throttler and updated documentationsidekiq-job-throttling
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/sidekiq_throttler.rb | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/gitlab/sidekiq_throttler.rb b/lib/gitlab/sidekiq_throttler.rb index 771736e7606..d4d39a888e7 100644 --- a/lib/gitlab/sidekiq_throttler.rb +++ b/lib/gitlab/sidekiq_throttler.rb @@ -3,18 +3,20 @@ module Gitlab class << self def execute! if Gitlab::CurrentSettings.sidekiq_throttling_enabled? - current_application_settings.sidekiq_throttling_queues.each do |queue| - Sidekiq::Queue[queue].limit = set_limit + Gitlab::CurrentSettings.current_application_settings.sidekiq_throttling_queues.each do |queue| + Sidekiq::Queue[queue].limit = queue_limit end end end private - def set_limit - factor = current_application_settings.sidekiq_throttling_factor - - (factor * Sidekiq.options[:concurrency]).ceil + def queue_limit + @queue_limit ||= + begin + factor = Gitlab::CurrentSettings.current_application_settings.sidekiq_throttling_factor + (factor * Sidekiq.options[:concurrency]).ceil + end end end end |