Class: ProjectExportWorker
- Inherits:
-
Object
- Object
- ProjectExportWorker
- Includes:
- ApplicationWorker, ExceptionBacktrace
- Defined in:
- app/workers/project_export_worker.rb
Overview
rubocop:disable Scalability/IdempotentWorker
Constant Summary
Constants included from ApplicationWorker
ApplicationWorker::LOGGING_EXTRA_KEY, ApplicationWorker::SAFE_PUSH_BULK_LIMIT
Constants included from Gitlab::Loggable
Constants included from WorkerAttributes
WorkerAttributes::DEFAULT_CONCURRENCY_LIMIT_PERCENTAGE_BY_URGENCY, WorkerAttributes::DEFAULT_DATA_CONSISTENCY, WorkerAttributes::DEFAULT_DATA_CONSISTENCY_PER_DB, WorkerAttributes::DEFAULT_DEFER_DELAY, WorkerAttributes::LOAD_BALANCED_DATA_CONSISTENCIES, WorkerAttributes::NAMESPACE_WEIGHTS, WorkerAttributes::VALID_DATA_CONSISTENCIES, WorkerAttributes::VALID_RESOURCE_BOUNDARIES, WorkerAttributes::VALID_URGENCIES
Instance Method Summary collapse
Methods included from Gitlab::Loggable
Methods included from Gitlab::SidekiqVersioning::Worker
Methods included from WorkerContext
Instance Method Details
#perform(current_user_id, project_id, after_export_strategy = {}, params = {}) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'app/workers/project_export_worker.rb', line 17 def perform(current_user_id, project_id, after_export_strategy = {}, params = {}) current_user = User.find(current_user_id) params.symbolize_keys! project = Project.find(project_id) export_job = project.export_jobs.safe_find_or_create_by(jid: self.jid) do |job| job.user = current_user job.exported_by_admin = !!params[:exported_by_admin] end after_export = build!(after_export_strategy) export_job&.start export_service = ::Projects::ImportExport::ExportService.new(project, current_user, params) export_service.execute(after_export) log_exporters_duration(export_service) export_job&.finish rescue ActiveRecord::RecordNotFound => e log_failure(project_id, e) rescue Import::AfterExportStrategies::AfterExportStrategyBuilder::StrategyNotFoundError => e log_failure(project_id, e) export_job&.finish rescue StandardError => e log_failure(project_id, e) export_job&.fail_op raise end |