diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-18 12:09:13 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-18 12:09:13 +0000 |
commit | 1363ca12f1f07c634647cf55c4c16b7401098673 (patch) | |
tree | d932caf09c8148322edb51ae954ed159ff7d00f8 /app/workers/concerns/gitlab | |
parent | 6763d2787670bc03a36a8eb601703e88fc70dece (diff) | |
download | gitlab-ce-1363ca12f1f07c634647cf55c4c16b7401098673.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/workers/concerns/gitlab')
-rw-r--r-- | app/workers/concerns/gitlab/jira_import/import_worker.rb | 35 | ||||
-rw-r--r-- | app/workers/concerns/gitlab/jira_import/queue_options.rb | 16 |
2 files changed, 51 insertions, 0 deletions
diff --git a/app/workers/concerns/gitlab/jira_import/import_worker.rb b/app/workers/concerns/gitlab/jira_import/import_worker.rb new file mode 100644 index 00000000000..7cc650bfc29 --- /dev/null +++ b/app/workers/concerns/gitlab/jira_import/import_worker.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +module Gitlab + module JiraImport + module ImportWorker + extend ActiveSupport::Concern + + included do + include ApplicationWorker + include Gitlab::JiraImport::QueueOptions + end + + def perform(project_id) + project = Project.find_by(id: project_id) # rubocop: disable CodeReuse/ActiveRecord + + return unless can_import?(project) + + import(project) + end + + private + + def import(project) + raise NotImplementedError + end + + def can_import?(project) + return false unless project + return false if Feature.disabled?(:jira_issue_import, project) + + project.import_state.started? + end + end + end +end diff --git a/app/workers/concerns/gitlab/jira_import/queue_options.rb b/app/workers/concerns/gitlab/jira_import/queue_options.rb new file mode 100644 index 00000000000..bc1148f7d3b --- /dev/null +++ b/app/workers/concerns/gitlab/jira_import/queue_options.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Gitlab + module JiraImport + module QueueOptions + extend ActiveSupport::Concern + + included do + queue_namespace :jira_importer + feature_category :importers + + sidekiq_options retry: 5 + end + end + end +end |