summaryrefslogtreecommitdiff
path: root/lib/gitlab/github_import/sequential_importer.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/github_import/sequential_importer.rb')
-rw-r--r--lib/gitlab/github_import/sequential_importer.rb29
1 files changed, 26 insertions, 3 deletions
diff --git a/lib/gitlab/github_import/sequential_importer.rb b/lib/gitlab/github_import/sequential_importer.rb
index cb6b2017208..6bc37337799 100644
--- a/lib/gitlab/github_import/sequential_importer.rb
+++ b/lib/gitlab/github_import/sequential_importer.rb
@@ -33,18 +33,41 @@ module Gitlab
end
def execute
- Importer::RepositoryImporter.new(project, client).execute
+ metrics.track_start_import
- SEQUENTIAL_IMPORTERS.each do |klass|
- klass.new(project, client).execute
+ begin
+ Importer::RepositoryImporter.new(project, client).execute
+
+ SEQUENTIAL_IMPORTERS.each do |klass|
+ klass.new(project, client).execute
+ end
+
+ rescue StandardError => e
+ Gitlab::Import::ImportFailureService.track(
+ project_id: project.id,
+ error_source: self.class.name,
+ exception: e,
+ fail_import: true,
+ metrics: true
+ )
+
+ raise(e)
end
PARALLEL_IMPORTERS.each do |klass|
klass.new(project, client, parallel: false).execute
end
+ metrics.track_finished_import
+
true
end
+
+ private
+
+ def metrics
+ @metrics ||= Gitlab::Import::Metrics.new(:github_importer, project)
+ end
end
end
end