Class: Projects::ImportExport::CreateRelationExportsWorker
- Inherits:
-
Object
- Object
- Projects::ImportExport::CreateRelationExportsWorker
- Includes:
- ApplicationWorker, ExceptionBacktrace
- Defined in:
- app/workers/projects/import_export/create_relation_exports_worker.rb
Constant Summary collapse
- INITIAL_DELAY =
This delay is an arbitrary number to finish the export quicker in case all relations are exported before the first execution of the WaitRelationExportsWorker worker.
10.seconds
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
-
#perform(user_id, project_id, after_export_strategy = {}) ⇒ Object
rubocop: disable CodeReuse/ActiveRecord.
Methods included from Gitlab::Loggable
Methods included from Gitlab::SidekiqVersioning::Worker
Methods included from WorkerContext
Instance Method Details
#perform(user_id, project_id, after_export_strategy = {}) ⇒ Object
rubocop: disable CodeReuse/ActiveRecord
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'app/workers/projects/import_export/create_relation_exports_worker.rb', line 21 def perform(user_id, project_id, after_export_strategy = {}) project = Project.find_by_id(project_id) return unless project project_export_job = project.export_jobs.find_or_create_by!(jid: jid) return if project_export_job.started? relation_exports = RelationExport.relation_names_list.map do |relation_name| project_export_job.relation_exports.find_or_create_by!(relation: relation_name) end relation_exports.each do |relation_export| RelationExportWorker.with_status.perform_async(relation_export.id) end WaitRelationExportsWorker.perform_in( INITIAL_DELAY, project_export_job.id, user_id, after_export_strategy ) project_export_job.start! end |