Module: Celerbrake::Resque::Job

Defined in:
lib/celerbrake/resque.rb

Overview

Measures elapsed time of a job and notifies Celerbrake of the execution status.

Since:

  • v9.6.0

Instance Method Summary collapse

Instance Method Details

#performObject

Since:

  • v9.6.0



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/celerbrake/resque.rb', line 40

def perform
  timing = Celerbrake::Benchmark.measure do
    super
  end
rescue StandardError => exception
  Celerbrake.notify_queue_sync(
    queue: payload['class'],
    error_count: 1,
    timing: 0.01,
  )
  raise exception
else
  Celerbrake.notify_queue_sync(
    queue: payload['class'],
    error_count: 0,
    timing: timing,
  )
end