Module: Airbrake::Resque::Job

Defined in:
lib/airbrake/resque.rb

Overview

Measures elapsed time of a job and notifies Airbrake 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/airbrake/resque.rb', line 40

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