Skip to content

Instantly share code, notes, and snippets.

@mmarschall
Created September 20, 2010 17:23
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 mmarschall/588256 to your computer and use it in GitHub Desktop.
Save mmarschall/588256 to your computer and use it in GitHub Desktop.
# initializer
Resque::Failure::Multiple.configure do |config|
config.classes = [Resque::Failure::Redis, Resque::Failure::Notifier]
end
#lib/resque/failure/notifier.rb
#===============================
module Resque
module Failure
# Store a copy of the failure in Redis, so we have access from the UI. Also
# send an email to the developer, so we know something went foul.
class Notifier < Base
def save
# Create notification email
email = TMail::Mail.new
email.to = my_email_address
email.subject = "[Resque] #{exception}"
email.body = <<-EOF
Queue: #{queue}
Worker: #{worker}
#{payload.inspect}
#{exception}
#{exception.backtrace.join("\n")}
EOF
Mailer.deliver email
rescue
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment