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:
Diffstat (limited to 'lib/gitlab/github_import/parallel_scheduling.rb')
-rw-r--r--lib/gitlab/github_import/parallel_scheduling.rb29
1 files changed, 8 insertions, 21 deletions
diff --git a/lib/gitlab/github_import/parallel_scheduling.rb b/lib/gitlab/github_import/parallel_scheduling.rb
index ab20b372d53..a8c18c74d24 100644
--- a/lib/gitlab/github_import/parallel_scheduling.rb
+++ b/lib/gitlab/github_import/parallel_scheduling.rb
@@ -63,7 +63,7 @@ module Gitlab
# Imports all the objects in sequence in the current thread.
def sequential_import
each_object_to_import do |object|
- repr = representation_class.from_api_response(object)
+ repr = representation_class.from_api_response(object, additional_object_data)
importer_class.new(repr, project, client).execute
end
@@ -72,26 +72,9 @@ module Gitlab
# Imports all objects in parallel by scheduling a Sidekiq job for every
# individual object.
def parallel_import
- if parallel_import_batch.present?
- spread_parallel_import
- else
- parallel_import_deprecated
- end
- end
-
- def parallel_import_deprecated
- waiter = JobWaiter.new
-
- each_object_to_import do |object|
- repr = representation_class.from_api_response(object)
-
- sidekiq_worker_class
- .perform_async(project.id, repr.to_hash, waiter.key)
+ raise 'Batch settings must be defined for parallel import' if parallel_import_batch.blank?
- waiter.jobs_remaining += 1
- end
-
- waiter
+ spread_parallel_import
end
def spread_parallel_import
@@ -100,7 +83,7 @@ module Gitlab
import_arguments = []
each_object_to_import do |object|
- repr = representation_class.from_api_response(object)
+ repr = representation_class.from_api_response(object, additional_object_data)
import_arguments << [project.id, repr.to_hash, waiter.key]
@@ -223,6 +206,10 @@ module Gitlab
private
+ def additional_object_data
+ {}
+ end
+
def info(project_id, extra = {})
Logger.info(log_attributes(project_id, extra))
end