当 sidekiq 失败时,如何启用电子邮件发送功能?目前我知道异常通知程序正在工作,但当 sidekiq 作业失败时,它不会执行任何操作。
最佳答案
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
还要确保您拥有较新版本的异常通知程序,它的 handle_background_exception
方法接受 2 个参数
关于ruby-on-rails - sidekiq 不会发送异常通知电子邮件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13014570/