Commit bc8eebf0 authored by James Lopez's avatar James Lopez

add export worker to process project export async

parent 1990616a
...@@ -1034,4 +1034,14 @@ class Project < ActiveRecord::Base ...@@ -1034,4 +1034,14 @@ class Project < ActiveRecord::Base
def wiki def wiki
@wiki ||= ProjectWiki.new(self, self.owner) @wiki ||= ProjectWiki.new(self, self.owner)
end 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 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%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment