summaryrefslogtreecommitdiff
path: root/lib/gitlab/patch/sidekiq_cron_poller.rb
blob: 630c364d4558b5132517ebf5746502b37cd37193 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# frozen_string_literal: true

# Patch to address https://github.com/ondrejbartas/sidekiq-cron/issues/361
# This restores the poll interval to v1.2.0 behavior
# https://github.com/ondrejbartas/sidekiq-cron/blob/v1.2.0/lib/sidekiq/cron/poller.rb#L36-L38
# This patch only applies to v1.4.0
require 'sidekiq/cron/version'

if Gem::Version.new(Sidekiq::Cron::VERSION) != Gem::Version.new('1.4.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
        Sidekiq.options[:poll_interval] || Sidekiq::Cron::POLL_INTERVAL
      end
    end
  end
end