diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-23 15:09:36 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-23 15:09:36 +0000 |
commit | 074d013e1eb3f6e0c27f96a3be8b9361254c8a98 (patch) | |
tree | f185c474ddc8624a4793c84b0b1f4cc07349694b /lib/gitlab/sidekiq_middleware | |
parent | 8f9beefac3774b30e911fb00a68f4c7a5244cf27 (diff) | |
download | gitlab-ce-074d013e1eb3f6e0c27f96a3be8b9361254c8a98.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/sidekiq_middleware')
-rw-r--r-- | lib/gitlab/sidekiq_middleware/duplicate_jobs.rb | 14 | ||||
-rw-r--r-- | lib/gitlab/sidekiq_middleware/duplicate_jobs/duplicate_job.rb | 2 |
2 files changed, 13 insertions, 3 deletions
diff --git a/lib/gitlab/sidekiq_middleware/duplicate_jobs.rb b/lib/gitlab/sidekiq_middleware/duplicate_jobs.rb index 23222430902..f0e26f99c2c 100644 --- a/lib/gitlab/sidekiq_middleware/duplicate_jobs.rb +++ b/lib/gitlab/sidekiq_middleware/duplicate_jobs.rb @@ -5,8 +5,18 @@ require 'digest' module Gitlab module SidekiqMiddleware module DuplicateJobs - def self.drop_duplicates? - Feature.enabled?(:drop_duplicate_sidekiq_jobs) + 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 diff --git a/lib/gitlab/sidekiq_middleware/duplicate_jobs/duplicate_job.rb b/lib/gitlab/sidekiq_middleware/duplicate_jobs/duplicate_job.rb index c6fb50b4610..a9007039334 100644 --- a/lib/gitlab/sidekiq_middleware/duplicate_jobs/duplicate_job.rb +++ b/lib/gitlab/sidekiq_middleware/duplicate_jobs/duplicate_job.rb @@ -67,7 +67,7 @@ module Gitlab end def droppable? - idempotent? && duplicate? && DuplicateJobs.drop_duplicates? + idempotent? && duplicate? && DuplicateJobs.drop_duplicates?(queue_name) end private |