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 'app/workers/concerns/gitlab/github_import/object_importer.rb')
-rw-r--r--app/workers/concerns/gitlab/github_import/object_importer.rb36
1 files changed, 8 insertions, 28 deletions
diff --git a/app/workers/concerns/gitlab/github_import/object_importer.rb b/app/workers/concerns/gitlab/github_import/object_importer.rb
index e190ced5073..fcc7a96fa2b 100644
--- a/app/workers/concerns/gitlab/github_import/object_importer.rb
+++ b/app/workers/concerns/gitlab/github_import/object_importer.rb
@@ -10,7 +10,6 @@ module Gitlab
included do
include ApplicationWorker
- sidekiq_options retry: 3
include GithubImport::Queue
include ReschedulingMethods
@@ -19,11 +18,8 @@ module Gitlab
sidekiq_retries_exhausted do |msg|
args = msg['args']
- correlation_id = msg['correlation_id']
jid = msg['jid']
- new.perform_failure(args[0], args[1], correlation_id)
-
# If a job is being exhausted we still want to notify the
# Gitlab::Import::AdvanceStageWorker to prevent the entire import from getting stuck
if args.length == 3 && (key = args.last) && key.is_a?(String)
@@ -64,29 +60,15 @@ module Gitlab
rescue NoMethodError => e
# This exception will be more useful in development when a new
# Representation is created but the developer forgot to add a
- # `:github_identifiers` field.
+ # `#github_identifiers` method.
track_and_raise_exception(project, e, fail_import: true)
rescue ActiveRecord::RecordInvalid, NotRetriableError => e
# We do not raise exception to prevent job retry
- failure = track_exception(project, e)
- add_identifiers_to_failure(failure, object.github_identifiers)
+ track_exception(project, e)
rescue StandardError => e
track_and_raise_exception(project, e)
end
- # hash - A Hash containing the details of the object to import.
- def perform_failure(project_id, hash, correlation_id)
- project = Project.find_by_id(project_id)
- return unless project
-
- failure = project.import_failures.failures_by_correlation_id(correlation_id).first
- return unless failure
-
- object = representation_class.from_json_hash(hash)
-
- add_identifiers_to_failure(failure, object.github_identifiers)
- end
-
def increment_object_counter?(_object)
true
end
@@ -118,16 +100,20 @@ module Gitlab
extra.merge(
project_id: project_id,
importer: importer_class.name,
- github_identifiers: github_identifiers
+ external_identifiers: github_identifiers
)
end
def track_exception(project, exception, fail_import: false)
+ external_identifiers = github_identifiers || {}
+ external_identifiers[:object_type] ||= object_type&.to_s
+
Gitlab::Import::ImportFailureService.track(
project_id: project.id,
error_source: importer_class.name,
exception: exception,
- fail_import: fail_import
+ fail_import: fail_import,
+ external_identifiers: external_identifiers
)
end
@@ -136,12 +122,6 @@ module Gitlab
raise(exception)
end
-
- def add_identifiers_to_failure(failure, external_identifiers)
- external_identifiers[:object_type] = object_type
-
- failure.update_column(:external_identifiers, external_identifiers)
- end
end
end
end