Class: Projects::ImportExport::WaitRelationExportsWorker

Inherits:
Object
  • Object
show all
Includes:
ApplicationWorker, ExceptionBacktrace
Defined in:
app/workers/projects/import_export/wait_relation_exports_worker.rb

Constant Summary collapse

INTERVAL =
1.minute

Constants included from ApplicationWorker

ApplicationWorker::LOGGING_EXTRA_KEY, ApplicationWorker::SAFE_PUSH_BULK_LIMIT

Constants included from Gitlab::Loggable

Gitlab::Loggable::ANONYMOUS

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

#build_structured_payload

Methods included from Gitlab::SidekiqVersioning::Worker

#job_version

Methods included from WorkerContext

#with_context

Instance Method Details

#perform(project_export_job_id, user_id, after_export_strategy = {}) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'app/workers/projects/import_export/wait_relation_exports_worker.rb', line 19

def perform(project_export_job_id, user_id, after_export_strategy = {})
  @export_job = ProjectExportJob.find(project_export_job_id)

  return unless @export_job.started?

  @export_job.update_attribute(:jid, jid)
  @relation_exports = @export_job.relation_exports

  if queued_relation_exports.any? || started_relation_exports.any?
    fail_started_jobs_no_longer_running

    self.class.perform_in(INTERVAL, project_export_job_id, user_id, after_export_strategy)
    return
  end

  if all_relation_export_finished?
    ParallelProjectExportWorker.perform_async(project_export_job_id, user_id, after_export_strategy)
    return
  end

  fail_and_notify_user(user_id)
end