debian-mirror-gitlab/app/workers/project_export_worker.rb
2019-12-26 22:10:19 +05:30

26 lines
765 B
Ruby

# frozen_string_literal: true
class ProjectExportWorker
include ApplicationWorker
include ExceptionBacktrace
sidekiq_options retry: 3
feature_category :source_code_management
worker_resource_boundary :memory
def perform(current_user_id, project_id, after_export_strategy = {}, params = {})
current_user = User.find(current_user_id)
project = Project.find(project_id)
after_export = build!(after_export_strategy)
::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)
end
end