提交 bc8eebf0 编写于 作者: J James Lopez

add export worker to process project export async

上级 1990616a
......@@ -1034,4 +1034,14 @@ class Project < ActiveRecord::Base
def wiki
@wiki ||= ProjectWiki.new(self, self.owner)
end
def add_export_job(current_user_id:)
job_id = ProjectExportWorker.perform_async(current_user_id, self.id)
if job_id
Rails.logger.info "Export job started for project ID #{self.id} with job ID #{job_id}"
else
Rails.logger.error "Export job failed to start for project ID #{self.id}"
end
end
end
class ProjectExportWorker
include Sidekiq::Worker
# TODO: enabled retry - disabled for QA purposes
sidekiq_options queue: :gitlab_shell, retry: false
def perform(current_user_id, project_id)
current_user = User.find(current_user_id)
project = Project.find(project_id)
::Projects::ImportExport::ExportService.new(project, current_user).execute
# TODO : Handle errors
end
end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册