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

duplicate_jobs.rb « sidekiq_middleware « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: f0e26f99c2c06c251235b13a4e312f62ececbf44 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# frozen_string_literal: true

require 'digest'

module Gitlab
  module SidekiqMiddleware
    module DuplicateJobs
      DROPPABLE_QUEUES = Set.new([
        Namespaces::RootStatisticsWorker.queue
      ]).freeze

      def self.drop_duplicates?(queue_name)
        Feature.enabled?(:drop_duplicate_sidekiq_jobs) ||
          drop_duplicates_for_queue?(queue_name)
      end

      private_class_method def self.drop_duplicates_for_queue?(queue_name)
        DROPPABLE_QUEUES.include?(queue_name) &&
          Feature.enabled?(:drop_duplicate_sidekiq_jobs_for_queue)
      end
    end
  end
end