summaryrefslogtreecommitdiff
path: root/app/workers/pipeline_hooks_worker.rb
blob: 40d138752b4f94bfcca5a6a486b93602031e5901 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# frozen_string_literal: true

class PipelineHooksWorker # rubocop:disable Scalability/IdempotentWorker
  include ApplicationWorker

  sidekiq_options retry: 3
  include PipelineQueue

  queue_namespace :pipeline_hooks
  worker_resource_boundary :cpu
  data_consistency :delayed

  # rubocop: disable CodeReuse/ActiveRecord
  def perform(pipeline_id)
    Ci::Pipeline.includes({ builds: { runner: :tags } })
      .find_by(id: pipeline_id)
      .try(:execute_hooks)
  end
  # rubocop: enable CodeReuse/ActiveRecord
end