Ruby on rails 在Rails 4中配置带有延迟作业的异常通知

Ruby on rails 在Rails 4中配置带有延迟作业的异常通知,ruby-on-rails,ruby-on-rails-4,delayed-job,exception-notification,Ruby On Rails,Ruby On Rails 4,Delayed Job,Exception Notification,当延迟作业失败时,我无法获取异常通知gem来通知我。我可以让作业失败,但不会发出通知。还有人知道这个吗 我正在使用: delayed_job_active_record (4.0.0) exception_notification (4.0.0) 并在我的初始值设定项/delayed_jobs_config中包含以下内容: # Chain delayed job's handle_failed_job method to do exception notification Delayed::W

当延迟作业失败时,我无法获取异常通知gem来通知我。我可以让作业失败,但不会发出通知。还有人知道这个吗

我正在使用:

delayed_job_active_record (4.0.0)
exception_notification (4.0.0)
并在我的初始值设定项/delayed_jobs_config中包含以下内容:

# Chain delayed job's handle_failed_job method to do exception notification
Delayed::Worker.class_eval do
  def handle_failed_job_with_notification(job, error)
    handle_failed_job_without_notification(job, error)
    # only actually send mail in production
    if Rails.env.production?
      # rescue if ExceptionNotifier fails for some reason
      begin
        ExceptionNotifier::Notifier.background_exception_notification(error)
      rescue Exception => e
        Rails.logger.error "ExceptionNotifier failed: #{e.class.name}: #{e.message}"
        e.backtrace.each do |f|
          Rails.logger.error "  #{f}"
        end
        Rails.logger.flush
      end
    end
  end
  alias_method_chain :handle_failed_job, :notification
end

自异常通知4.0以来。尝试改变

ExceptionNotifier::Notifier.background_exception_notification(error)
为了

ExceptionNotifier.notify_exception(error)