Delayed::Worker.max_attempts = 100
Delayed::Worker.max_run_time = 1.week

require 'active_job/queue_adapters/delayed_job_adapter'

# We patch in the display_name method to the Delayed Job queue adapter
# so that all the jobs aren't aggregated under one name in AppSignal.
module ActiveJob
  module QueueAdapters
    class DelayedJobAdapter
      class JobWrapper
        def display_name
          if job_data['job_class'] == 'ActionMailer::DeliveryJob'
            "#{job_data['arguments'][0]}##{job_data['arguments'][1]}"
          else
            "#{job_data['job_class']}#perform"
          end
        end
      end
    end
  end
end

Delayed::Worker.max_attempts = 15
Delayed::Worker.max_run_time = 6.hours

require 'active_job/queue_adapters/delayed_job_adapter'

# We patch in the display_name method to the Delayed Job queue adapter
# so that all the jobs aren't aggregated under one name in AppSignal.
module ActiveJob
  module QueueAdapters
    class DelayedJobAdapter
      class JobWrapper
        def display_name
          if job_data['job_class'] == 'ActionMailer::DeliveryJob'
            "#{job_data['arguments'][0]}##{job_data['arguments'][1]}"
          else
            "#{job_data['job_class']}#perform"
          end
        end
      end
    end
  end
end

Adjust delayed_job config to something more sane
Adjust delayed_job config to something more sane

The configured max runtime and max attempts were left as set in the initial
code dump fron the first version of the website. The rationale for the
chosen figures is lost in the mists of time but seem somewhat large.

The 1 week max runtime may have been to send out the bulk emails which is
understandable but will be not tolerable for users. The 100 max attempts
coupled with the backoff inherent in delayed_job means that the job would
be in the queue for over 61 years! Perhaps earlier versions of delayed_job
didn't have such a backoff? The figure of 15 for max attempts will mean a
job is re-tried for over 35 hours which is a reasonable period of time.
