diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-18 11:17:02 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-18 11:17:02 +0300 |
commit | b39512ed755239198a9c294b6a45e65c05900235 (patch) | |
tree | d234a3efade1de67c46b9e5a38ce813627726aa7 /lib/gitlab/github_import/parallel_scheduling.rb | |
parent | d31474cf3b17ece37939d20082b07f6657cc79a9 (diff) |
Add latest changes from gitlab-org/gitlab@15-3-stable-eev15.3.0-rc42
Diffstat (limited to 'lib/gitlab/github_import/parallel_scheduling.rb')
-rw-r--r-- | lib/gitlab/github_import/parallel_scheduling.rb | 29 |
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 |