Class: Hekenga::ParallelJob

Inherits:
ActiveJob::Base
  • Object
show all
Defined in:
lib/hekenga/parallel_job.rb

Instance Method Summary collapse

Instance Method Details

#perform(document_task_record_id, executor_key) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/hekenga/parallel_job.rb', line 7

def perform(document_task_record_id, executor_key)
  record = Hekenga::DocumentTaskRecord.where(_id: document_task_record_id).first
  return if record.nil?
  return if record.executor_key != BSON::ObjectId(executor_key)
  return if record.complete?

  executor = Hekenga::DocumentTaskExecutor.new(record)
  return if executor.migration_cancelled?

  executor.run!
  executor.check_for_completion!
end