diff options
Diffstat (limited to 'app/workers/bulk_imports/export_request_worker.rb')
-rw-r--r-- | app/workers/bulk_imports/export_request_worker.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/app/workers/bulk_imports/export_request_worker.rb b/app/workers/bulk_imports/export_request_worker.rb index 8bc0acc9b22..21040178cee 100644 --- a/app/workers/bulk_imports/export_request_worker.rb +++ b/app/workers/bulk_imports/export_request_worker.rb @@ -14,6 +14,10 @@ module BulkImports entity = BulkImports::Entity.find(entity_id) request_export(entity) + rescue BulkImports::NetworkError => e + log_export_failure(e, entity) + + entity.fail_op! end private @@ -28,5 +32,24 @@ module BulkImports token: configuration.access_token ) end + + def log_export_failure(exception, entity) + attributes = { + bulk_import_entity_id: entity.id, + pipeline_class: 'ExportRequestWorker', + exception_class: exception.class.to_s, + exception_message: exception.message.truncate(255), + correlation_id_value: Labkit::Correlation::CorrelationId.current_or_new_id + } + + Gitlab::Import::Logger.warn( + attributes.merge( + bulk_import_id: entity.bulk_import.id, + bulk_import_entity_type: entity.source_type + ) + ) + + BulkImports::Failure.create(attributes) + end end end |