delayed_job.rb 585B

    Delayed::Worker.destroy_failed_jobs = false Delayed::Worker.max_attempts = 5 Delayed::Worker.max_run_time = 20.minutes Delayed::Worker.read_ahead = 5 Delayed::Worker.default_priority = 10 Delayed::Worker.delay_jobs = !Rails.env.test? # Delayed::Worker.logger = Logger.new(Rails.root.join('log', 'delayed_job.log')) # Delayed::Worker.logger.level = Logger::DEBUG class Delayed::Job scope :pending, ->{ where("locked_at IS NULL AND attempts = 0") } scope :awaiting_retry, ->{ where("failed_at IS NULL AND attempts > 0") } scope :failed, -> { where("failed_at IS NOT NULL") } end