Welcome to mirror list, hosted at ThFree Co, Russian Federation.

bulk_import_worker.rb « workers « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 70e7d82741f807c63af74c44b72c90a9ac640f63 (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
# frozen_string_literal: true

class BulkImportWorker
  include ApplicationWorker

  data_consistency :always
  feature_category :importers
  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)
    return unless bulk_import

    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