Class: Bugsnag::Resque

Inherits:
Resque::Failure::Base
  • Object
show all
Defined in:
lib/bugsnag/resque.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.add_failure_backendObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/bugsnag/resque.rb', line 11

def self.add_failure_backend
  return if ::Resque::Failure.backend == self

  # Ensure resque is using a "Multiple" failure backend
  unless ::Resque::Failure.backend < ::Resque::Failure::Multiple
    original_backend = ::Resque::Failure.backend
    ::Resque::Failure.backend = ::Resque::Failure::Multiple
    ::Resque::Failure.backend.classes ||= []
    ::Resque::Failure.backend.classes << original_backend
  end

  # Add Bugsnag failure backend
  unless ::Resque::Failure.backend.classes.include?(self)
    ::Resque::Failure.backend.classes << self
  end
end

.configure(&block) ⇒ Object



6
7
8
9
# File 'lib/bugsnag/resque.rb', line 6

def self.configure(&block)
  add_failure_backend
  Bugsnag.configure(&block)
end

Instance Method Details

#saveObject



28
29
30
# File 'lib/bugsnag/resque.rb', line 28

def save
  Bugsnag.auto_notify(exception, {:context => "resque##{queue}", :payload => payload, :delivery_method => :synchronous})
end