debian-mirror-gitlab/app/workers/project_export_worker.rb

25 lines
687 B
Ruby
Raw Normal View History

2018-11-08 19:23:39 +05:30
# frozen_string_literal: true
2016-06-22 15:30:34 +05:30
class ProjectExportWorker
2018-03-17 18:26:18 +05:30
include ApplicationWorker
include ExceptionBacktrace
2016-06-22 15:30:34 +05:30
2016-11-03 12:29:30 +05:30
sidekiq_options retry: 3
2016-06-22 15:30:34 +05:30
2018-05-09 12:01:36 +05:30
def perform(current_user_id, project_id, after_export_strategy = {}, params = {})
2016-06-22 15:30:34 +05:30
current_user = User.find(current_user_id)
project = Project.find(project_id)
2018-05-09 12:01:36 +05:30
after_export = build!(after_export_strategy)
2016-06-22 15:30:34 +05:30
2018-05-09 12:01:36 +05:30
::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)
2016-06-22 15:30:34 +05:30
end
end