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

module MergeRequests
  class UpdateHeadPipelineWorker
    include Gitlab::EventStore::Subscriber

    feature_category :code_review
    urgency :high
    worker_resource_boundary :cpu
    data_consistency :always

    idempotent!

    def handle_event(event)
      Ci::Pipeline.find_by_id(event.data[:pipeline_id]).try do |pipeline|
        pipeline.all_merge_requests.opened.each do |merge_request|
          merge_request.update_head_pipeline
        end
      end
    end
  end
end