Skip to content
Snippets Groups Projects

Drop duplicate jobs from Sidekiq when enqueuing

All threads resolved!
9 files
+ 175
18
Compare changes
  • Side-by-side
  • Inline
Files
9
  • 161ef851
    This extends the `UntilExecuting` deduplication strategy to cancel
    scheduling jobs when they are already in the queue.
    
    We only deduplicate when the `drop_duplicate_sidekiq_jobs` feature
    flag is enabled for now.
    
    When we drop a job, we log that to the Gitlab::SidekiqLogger.
# frozen_string_literal: true
module Gitlab
module SidekiqLogging
class DeduplicationLogger
include Singleton
include LogsJobs
def log_deduplication(job, deduplication_type)
payload = parse_job(job)
payload['job_status'] = 'deduplicated'
payload['message'] = "#{base_message(payload)}: deduplicated: #{deduplication_type}"
payload['deduplication_type'] = deduplication_type
+2
Gitlab::SidekiqLogger.info payload
end
end
end
end
Loading