Class: Gush::Worker

Inherits:
Object
  • Object
show all
Includes:
Sidekiq::Worker
Defined in:
lib/gush/worker.rb

Instance Method Summary collapse

Instance Method Details

#perform(workflow_id, job_id) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/gush/worker.rb', line 8

def perform(workflow_id, job_id)
  setup_job(workflow_id, job_id)

  job.payloads_hash = incoming_payloads

  start = Time.now
  report(:started, start)

  failed = false
  error = nil

  mark_as_started
  begin
    job.work
  rescue Exception => error
    mark_as_failed
    report(:failed, start, error.message)
    raise error
  else
    mark_as_finished
    report(:finished, start)

    enqueue_outgoing_jobs
  end
end