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

sidekiq_cron_poller.rb « patch « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 8f1fbf53161ef6568f585e2c6bc3227f03d5e58f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# 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.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.5.12')
  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(count)
        Gitlab.config.cron_jobs.poll_interval || @config[:poll_interval_average] || scaled_poll_interval(count) # rubocop:disable Gitlab/ModuleWithInstanceVariables
      end
    end
  end
end