diff options
Diffstat (limited to 'app/workers')
-rw-r--r-- | app/workers/repository_import_worker.rb | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/app/workers/repository_import_worker.rb b/app/workers/repository_import_worker.rb index 25fec542ac7..16b93313ece 100644 --- a/app/workers/repository_import_worker.rb +++ b/app/workers/repository_import_worker.rb @@ -6,10 +6,12 @@ class RepositoryImportWorker include ProjectStartImport include ProjectImportOptions + attr_reader :project + def perform(project_id) - project = Project.find(project_id) + @project = Project.find(project_id) - return unless start_import(project) + return unless start_import Gitlab::Metrics.add_event(:import_repository, import_url: project.import_url, @@ -23,7 +25,7 @@ class RepositoryImportWorker return if service.async? if result[:status] == :error - fail_import(project, result[:message]) if project.gitlab_project_import? + fail_import(result[:message]) if template_import? raise result[:message] end @@ -33,14 +35,18 @@ class RepositoryImportWorker private - def start_import(project) + def start_import return true if start(project) Rails.logger.info("Project #{project.full_path} was in inconsistent state (#{project.import_status}) while importing.") false end - def fail_import(project, message) + def fail_import(message) project.mark_import_as_failed(message) end + + def template_import? + project.gitlab_project_import? + end end |