Skip to content

Instantly share code, notes, and snippets.

@larsar
Forked from granth/delayed_job_airbrake.rb
Created November 20, 2013 11:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save larsar/7561403 to your computer and use it in GitHub Desktop.
Save larsar/7561403 to your computer and use it in GitHub Desktop.
module Delayed
module Plugins
class Airbrake < Plugin
module Notify
def error(job, error)
::Airbrake.notify_or_ignore(error)
super
end
end
callbacks do |lifecycle|
lifecycle.before(:invoke_job) do |job|
payload = job.payload_object
payload = payload.object if payload.is_a? Delayed::PerformableMethod
payload.extend Notify
end
end
end
end
end
Delayed::Worker.plugins << Delayed::Plugins::Airbrake
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment