project_export_worker.rb 687 字节
Newer Older
1 2
# frozen_string_literal: true

3
class ProjectExportWorker
4
  include ApplicationWorker
5
  include ExceptionBacktrace
6

7
  sidekiq_options retry: 3
8

9
  def perform(current_user_id, project_id, after_export_strategy = {}, params = {})
10 11
    current_user = User.find(current_user_id)
    project = Project.find(project_id)
12
    after_export = build!(after_export_strategy)
13

14 15 16 17 18 19 20 21 22
    ::Projects::ImportExport::ExportService.new(project, current_user, params).execute(after_export)
  end

  private

  def build!(after_export_strategy)
    strategy_klass = after_export_strategy&.delete('klass')

    Gitlab::ImportExport::AfterExportStrategyBuilder.build!(strategy_klass, after_export_strategy)
23 24
  end
end