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

import_worker.rb « jira_import « gitlab « concerns « workers « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d18b9ff023b363b12153bf72483fac38fe5cb752 (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
31
32
33
34
35
36
37
# frozen_string_literal: true

module Gitlab
  module JiraImport
    module ImportWorker
      extend ActiveSupport::Concern

      included do
        include ApplicationWorker

        sidekiq_options retry: 3
        include ProjectImportOptions
        include Gitlab::JiraImport::QueueOptions
      end

      def perform(project_id)
        project = Project.find_by_id(project_id)

        return unless can_import?(project)

        import(project)
      end

      private

      def import(project)
        raise NotImplementedError
      end

      def can_import?(project)
        return false unless project

        project.latest_jira_import&.started?
      end
    end
  end
end