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

advance_stage_worker.rb « jira_import « gitlab « workers « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c83a57bcd83edaa51a88452afef90a0bacc11b9f (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
27
28
29
30
# frozen_string_literal: true

module Gitlab
  module JiraImport
    class AdvanceStageWorker # rubocop:disable Scalability/IdempotentWorker
      include ApplicationWorker
      include QueueOptions
      include ::Gitlab::Import::AdvanceStage

      # The known importer stages and their corresponding Sidekiq workers.
      STAGES = {
        labels: Gitlab::JiraImport::Stage::ImportLabelsWorker,
        issues: Gitlab::JiraImport::Stage::ImportIssuesWorker,
        attachments: Gitlab::JiraImport::Stage::ImportAttachmentsWorker,
        notes: Gitlab::JiraImport::Stage::ImportNotesWorker,
        finish: Gitlab::JiraImport::Stage::FinishImportWorker
      }.freeze

      def find_import_state(project_id)
        ProjectImportState.jid_by(project_id: project_id, status: :started)
      end

      private

      def next_stage_worker(next_stage)
        STAGES.fetch(next_stage.to_sym)
      end
    end
  end
end