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/bulk_import_worker.rb')
-rw-r--r--app/workers/bulk_import_worker.rb17
1 files changed, 15 insertions, 2 deletions
diff --git a/app/workers/bulk_import_worker.rb b/app/workers/bulk_import_worker.rb
index 5b9b46081cc..70e7d82741f 100644
--- a/app/workers/bulk_import_worker.rb
+++ b/app/workers/bulk_import_worker.rb
@@ -1,11 +1,16 @@
# frozen_string_literal: true
-class BulkImportWorker # rubocop:disable Scalability/IdempotentWorker
+class BulkImportWorker
include ApplicationWorker
data_consistency :always
feature_category :importers
- sidekiq_options retry: false, dead: false
+ sidekiq_options retry: 3, dead: false
+ idempotent!
+
+ sidekiq_retries_exhausted do |msg, exception|
+ new.perform_failure(exception, msg['args'].first)
+ end
def perform(bulk_import_id)
bulk_import = BulkImport.find_by_id(bulk_import_id)
@@ -13,4 +18,12 @@ class BulkImportWorker # rubocop:disable Scalability/IdempotentWorker
BulkImports::ProcessService.new(bulk_import).execute
end
+
+ def perform_failure(exception, bulk_import_id)
+ bulk_import = BulkImport.find_by_id(bulk_import_id)
+
+ Gitlab::ErrorTracking.track_exception(exception, bulk_import_id: bulk_import.id)
+
+ bulk_import.fail_op
+ end
end