add logging for delayedJob
This commit is contained in:
parent
901eb4a513
commit
e66498a861
1 changed files with 12 additions and 7 deletions
|
@ -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'))
|
||||
|
|
Loading…
Reference in a new issue