blob: 08c5fb8146022738e130c8dde8329ac0fdd8c606 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# frozen_string_literal: true
module BulkImports
class RelationBatchExportWorker
include ApplicationWorker
idempotent!
data_consistency :always # rubocop:disable SidekiqLoadBalancing/WorkerDataConsistency
feature_category :importers
sidekiq_options status_expiration: StuckExportJobsWorker::EXPORT_JOBS_EXPIRATION, retry: 6
worker_resource_boundary :memory
sidekiq_retries_exhausted do |job, exception|
batch = BulkImports::ExportBatch.find(job['args'][1])
portable = batch.export.portable
Gitlab::ErrorTracking.track_exception(exception, portable_id: portable.id, portable_type: portable.class.name)
batch.update!(status_event: 'fail_op', error: exception.message.truncate(255))
end
def perform(user_id, batch_id)
@user = User.find(user_id)
@batch = BulkImports::ExportBatch.find(batch_id)
log_extra_metadata_on_done(:relation, @batch.export.relation)
log_extra_metadata_on_done(:objects_count, @batch.objects_count)
RelationBatchExportService.new(@user, @batch).execute
end
end
end
|