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

module JiraConnect
  class SyncMergeRequestWorker # rubocop:disable Scalability/IdempotentWorker
    include ApplicationWorker

    queue_namespace :jira_connect
    feature_category :integrations
    idempotent!

    worker_has_external_dependencies!

    def perform(merge_request_id, update_sequence_id)
      merge_request = MergeRequest.find_by_id(merge_request_id)

      return unless merge_request && merge_request.project

      JiraConnect::SyncService.new(merge_request.project).execute(merge_requests: [merge_request], update_sequence_id: update_sequence_id)
    end
  end
end