Welcome to mirror list, hosted at ThFree Co, Russian Federation.

sync_branch_worker.rb « jira_connect « workers « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: b8211286d1c35c41d592986666f8b808c6509596 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# frozen_string_literal: true

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

    sidekiq_options retry: 3

    queue_namespace :jira_connect
    feature_category :integrations
    loggable_arguments 1, 2
    worker_has_external_dependencies!
    idempotent!

    def perform(project_id, branch_name, commit_shas, update_sequence_id)
      project = Project.find_by_id(project_id)

      return unless project

      branches = [project.repository.find_branch(branch_name)] if branch_name.present?
      commits = project.commits_by(oids: commit_shas) if commit_shas.present?

      JiraConnect::SyncService.new(project).execute(commits: commits, branches: branches, update_sequence_id: update_sequence_id)
    end
  end
end