diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-10-20 06:09:08 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-10-20 06:09:08 +0300 |
commit | e83144f0eef1a161b69d2b991841674978014283 (patch) | |
tree | 58c2ab892ca053655d25e68f8416dfce104bb62a /lib/gitlab/patch | |
parent | 69b1c09769fbb48258f5de06fd3b4955b0758c1f (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 | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/gitlab/patch/sidekiq_cron_poller.rb b/lib/gitlab/patch/sidekiq_cron_poller.rb new file mode 100644 index 00000000000..87d6c8f324e --- /dev/null +++ b/lib/gitlab/patch/sidekiq_cron_poller.rb @@ -0,0 +1,28 @@ +# 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) +require 'sidekiq/version' +require 'sidekiq/cron/version' + +if Gem::Version.new(Sidekiq::VERSION) != Gem::Version.new('6.4.2') + raise 'New version of sidekiq detected, please remove or update this patch' +end + +if Gem::Version.new(Sidekiq::Cron::VERSION) != Gem::Version.new('1.8.0') + raise 'New version of sidekiq-cron detected, please remove or update this patch' +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 + Sidekiq.options[:cron_poll_interval] || Sidekiq.options[:poll_interval_average] || scaled_poll_interval + end + end + end +end |