add logging for delayedJob

This commit is contained in:
Connor Turland 2017-10-17 12:16:03 -04:00
parent 901eb4a513
commit e66498a861

View file

@ -1,9 +1,14 @@
# frozen_string_literal: true
module ExceptionNotifierInDelayedJob
def handle_failed_job(job, error)
super
ExceptionNotfier.notify_exception(error)
end
end
Delayed::Worker.class_eval do
def handle_failed_job_with_notification(job, error)
handle_failed_job_without_notification(job, error)
ExceptionNotifier.notify_exception(error)
prepend ExceptionNotifierInDelayedJob
end
alias_method_chain :handle_failed_job, :notification
end
Delayed::Worker.logger = Logger.new(File.join(Rails.root, 'log', 'delayed_job.log'))