sidekiq不会发送异常通知程序电子邮件

时间:2012-10-22 15:23:19

标签: ruby-on-rails redis sidekiq

如何在失败时启用从sidekiq发送的电子邮件?目前我知道异常通知程序正在工作,但是当sidekiq作业失败时,它什么都不做。

1 个答案:

答案 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方法