diff --git a/config/initializers/delayed_job.rb b/config/initializers/delayed_job.rb index d3132394..c4725b19 100644 --- a/config/initializers/delayed_job.rb +++ b/config/initializers/delayed_job.rb @@ -1,9 +1,14 @@ -Delayed::Worker.class_eval do - - def handle_failed_job_with_notification(job, error) - handle_failed_job_without_notification(job, error) - ExceptionNotifier.notify_exception(error) - end - alias_method_chain :handle_failed_job, :notification +# frozen_string_literal: true +module ExceptionNotifierInDelayedJob + def handle_failed_job(job, error) + super + ExceptionNotfier.notify_exception(error) + end end + +Delayed::Worker.class_eval do + prepend ExceptionNotifierInDelayedJob +end + +Delayed::Worker.logger = Logger.new(File.join(Rails.root, 'log', 'delayed_job.log'))