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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2017-11-08 14:52:39 +0300
committerDouwe Maan <douwe@gitlab.com>2017-11-08 14:52:39 +0300
commit92249f1ac883c2a861235ec49526cbafca73b362 (patch)
treed2f7de8ed87dfca2a8102e4bc713ece048e6994e /app/services
parent3c369ba16e5c5a7d8a9f6187e08cb504c1ad91a6 (diff)
parent6e242e82237ad2cf362098f3f42f4a9dd1a4ad27 (diff)
Merge branch 'github-importer-refactor' into 'master'
Rewrite the GitHub importer to perform work in parallel and greatly improve performance Closes #33135, #38621, and #39361 See merge request gitlab-org/gitlab-ce!14731
Diffstat (limited to 'app/services')
-rw-r--r--app/services/projects/import_service.rb18
1 files changed, 17 insertions, 1 deletions
diff --git a/app/services/projects/import_service.rb b/app/services/projects/import_service.rb
index 455b302d819..c950da44aba 100644
--- a/app/services/projects/import_service.rb
+++ b/app/services/projects/import_service.rb
@@ -4,6 +4,18 @@ module Projects
Error = Class.new(StandardError)
+ # Returns true if this importer is supposed to perform its work in the
+ # background.
+ #
+ # This method will only return `true` if async importing is explicitly
+ # supported by an importer class (`Gitlab::GithubImport::ParallelImporter`
+ # for example).
+ def async?
+ return false unless has_importer?
+
+ !!importer_class.try(:async?)
+ end
+
def execute
add_repository_to_project unless project.gitlab_project_import?
@@ -75,12 +87,16 @@ module Projects
end
end
+ def importer_class
+ Gitlab::ImportSources.importer(project.import_type)
+ end
+
def has_importer?
Gitlab::ImportSources.importer_names.include?(project.import_type)
end
def importer
- Gitlab::ImportSources.importer(project.import_type).new(project)
+ importer_class.new(project)
end
def unknown_url?