diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-08 21:11:09 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-08 21:11:09 +0300 |
commit | da576e4a0b8e1adc3df559a163b01c962a565ef5 (patch) | |
tree | f563a8746fd54a2d638f6b421955220af24c8489 /lib/gitlab/patch | |
parent | b5bdf6e5219b3b57107aee49ba7c103affb65dd9 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/patch')
-rw-r--r-- | lib/gitlab/patch/sidekiq_cron_poller.rb | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/lib/gitlab/patch/sidekiq_cron_poller.rb b/lib/gitlab/patch/sidekiq_cron_poller.rb index 1c24707499e..c9eae2f899f 100644 --- a/lib/gitlab/patch/sidekiq_cron_poller.rb +++ b/lib/gitlab/patch/sidekiq_cron_poller.rb @@ -1,12 +1,13 @@ # frozen_string_literal: true # Patch to address https://gitlab.com/gitlab-com/gl-infra/scalability/-/issues/1932 -# It restores the behavior of `poll_internal_average` to the one from Sidekiq 6.4.2 -# (see https://github.com/mperham/sidekiq/blob/v6.4.2/lib/sidekiq/scheduled.rb#L173-L175) +# It restores the behavior of `poll_internal_average` to the one from Sidekiq 6.5.7 +# when the cron poll interval is not configured. +# (see https://github.com/mperham/sidekiq/blob/v6.5.7/lib/sidekiq/scheduled.rb#L176-L178) require 'sidekiq/version' require 'sidekiq/cron/version' -if Gem::Version.new(Sidekiq::VERSION) != Gem::Version.new('6.4.2') +if Gem::Version.new(Sidekiq::VERSION) != Gem::Version.new('6.5.7') raise 'New version of sidekiq detected, please remove or update this patch' end @@ -17,11 +18,8 @@ end module Gitlab module Patch module SidekiqCronPoller - def poll_interval_average - # Note: This diverges from the Sidekiq implementation in 6.4.2 to address a bug where the poll interval wouldn't - # scale properly when the process count changes, and to take into account the `cron_poll_interval` setting. See - # https://gitlab.com/gitlab-org/gitlab/-/merge_requests/99030#note_1117078517 for more details - Gitlab.config.cron_jobs.poll_interval || Sidekiq.options[:poll_interval_average] || scaled_poll_interval + def poll_interval_average(count) + Gitlab.config.cron_jobs.poll_interval || @config[:poll_interval_average] || scaled_poll_interval(count) # rubocop:disable Gitlab/ModuleWithInstanceVariables end end end |