1# frozen_string_literal: true
2
3# rubocop: disable Scalability/IdempotentWorker
4class ExpirePipelineCacheWorker
5  include ApplicationWorker
6
7  sidekiq_options retry: 3
8  include PipelineQueue
9
10  queue_namespace :pipeline_cache
11  urgency :high
12  worker_resource_boundary :cpu
13  data_consistency :delayed
14
15  # This worker _should_ be idempotent, but due to us moving this to data_consistency :delayed
16  # and an ongoing incompatibility between the two switches, we need to disable this.
17  # Uncomment once https://gitlab.com/gitlab-org/gitlab/-/issues/325291 is resolved
18  # idempotent!
19
20  def perform(pipeline_id)
21    pipeline = Ci::Pipeline.find_by_id(pipeline_id)
22    return unless pipeline
23
24    Ci::ExpirePipelineCacheService.new.execute(pipeline)
25  end
26end
27# rubocop:enable Scalability/IdempotentWorker
28