diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-19 21:10:32 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-19 21:10:32 +0300 |
commit | 21db5294d4ba402f9d44a1f59e8344daef0911a2 (patch) | |
tree | d888dbe0a42ce86efe9e235602fe5209b196ada7 /app/workers/gitlab/github_import/stage/import_notes_worker.rb | |
parent | 155f106fd5b5214c387e9b9143e9fa5725daed54 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/workers/gitlab/github_import/stage/import_notes_worker.rb')
-rw-r--r-- | app/workers/gitlab/github_import/stage/import_notes_worker.rb | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/app/workers/gitlab/github_import/stage/import_notes_worker.rb b/app/workers/gitlab/github_import/stage/import_notes_worker.rb index 0160145ffe2..90a1337169f 100644 --- a/app/workers/gitlab/github_import/stage/import_notes_worker.rb +++ b/app/workers/gitlab/github_import/stage/import_notes_worker.rb @@ -15,17 +15,31 @@ module Gitlab # client - An instance of Gitlab::GithubImport::Client. # project - An instance of Project. def import(client, project) - info(project.id, message: "starting importer", importer: 'Importer::NotesImporter') - waiter = Importer::NotesImporter - .new(project, client) - .execute + waiters = importers(project).each_with_object({}) do |klass, hash| + info(project.id, message: "starting importer", importer: klass.name) + waiter = klass.new(project, client).execute + hash[waiter.key] = waiter.jobs_remaining + end AdvanceStageWorker.perform_async( project.id, - { waiter.key => waiter.jobs_remaining }, + waiters, :lfs_objects ) end + + def importers(project) + if project.group.present? && Feature.enabled?(:github_importer_single_endpoint_notes_import, project.group, type: :ops, default_enabled: :yaml) + [ + Importer::SingleEndpointMergeRequestNotesImporter, + Importer::SingleEndpointIssueNotesImporter + ] + else + [ + Importer::NotesImporter + ] + end + end end end end |