Class: Burstflow::Worker

Inherits:
ActiveJob::Base
  • Object
show all
Defined in:
lib/burstflow/worker.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#jobObject (readonly)

Returns the value of attribute job.



5
6
7
# File 'lib/burstflow/worker.rb', line 5

def job
  @job
end

#workflowObject (readonly)

Returns the value of attribute workflow.



5
6
7
# File 'lib/burstflow/worker.rb', line 5

def workflow
  @workflow
end

Instance Method Details

#perform(_workflow_id, _job_id, resume_data = nil) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/burstflow/worker.rb', line 30

def perform(_workflow_id, _job_id, resume_data = nil)
  result = if resume_data.nil?
             job.start!
             job.save!

             job.perform_now
           else
             job.resume!
             job.save!

             job.resume_now(resume_data)
  end

  @manager.job_performed!(job, result)
end