diff options
Diffstat (limited to 'app/workers/bulk_imports/entity_worker.rb')
-rw-r--r-- | app/workers/bulk_imports/entity_worker.rb | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/app/workers/bulk_imports/entity_worker.rb b/app/workers/bulk_imports/entity_worker.rb index 9b60dcdeb8a..e510a8c0d06 100644 --- a/app/workers/bulk_imports/entity_worker.rb +++ b/app/workers/bulk_imports/entity_worker.rb @@ -5,12 +5,16 @@ module BulkImports include ApplicationWorker idempotent! - deduplicate :until_executed + deduplicate :until_executed, if_deduplicated: :reschedule_once data_consistency :always feature_category :importers - sidekiq_options retry: false, dead: false + sidekiq_options retry: 3, dead: false worker_has_external_dependencies! + sidekiq_retries_exhausted do |msg, exception| + new.perform_failure(exception, msg['args'].first) + end + PERFORM_DELAY = 5.seconds # Keep `_current_stage` parameter for backwards compatibility. @@ -27,10 +31,17 @@ module BulkImports end re_enqueue - rescue StandardError => e - Gitlab::ErrorTracking.track_exception(e, log_params(message: 'Entity failed')) + end + + def perform_failure(exception, entity_id) + @entity = ::BulkImports::Entity.find(entity_id) + + Gitlab::ErrorTracking.track_exception( + exception, + log_params(message: "Request to export #{entity.source_type} failed") + ) - @entity.fail_op! + entity.fail_op! end private @@ -68,7 +79,7 @@ module BulkImports end def logger - @logger ||= Gitlab::Import::Logger.build + @logger ||= Logger.build end def log_exception(exception, payload) @@ -88,7 +99,7 @@ module BulkImports bulk_import_entity_type: entity.source_type, source_full_path: entity.source_full_path, source_version: source_version, - importer: 'gitlab_migration' + importer: Logger::IMPORTER_NAME } defaults.merge(extra) |