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_DATA_CONSISTENCY, WorkerAttributes::DEFAULT_DEFER_DELAY, 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
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'app/workers/project_export_worker.rb', line 16 def perform(current_user_id, project_id, after_export_strategy = {}, params = {}) current_user = User.find(current_user_id) project = Project.find(project_id) export_job = project.export_jobs.safe_find_or_create_by(jid: self.jid) 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 Gitlab::ImportExport::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 |