如何在失败时启用从sidekiq发送的电子邮件?目前我知道异常通知程序正在工作,但是当sidekiq作业失败时,它什么都不做。
答案 0 :(得分:3)
class DelayedWorker
include Sidekiq::Worker
# Utils include watchdog, which will email on failures
include Sidekiq::Util
def perform(type, args)
watchdog('DelayedWorker failed') do
raise 'Doh!'
puts "Doing hard work #{type} #{args.to_json}"
end
end
end
同时确保您拥有较新版本的异常通知程序,该通知程序将{2}参数纳入handle_background_exception
方法