demarches-normaliennes/app/jobs/application_job.rb
2020-09-02 16:59:54 +02:00

21 lines
485 B
Ruby

class ApplicationJob < ActiveJob::Base
DEFAULT_MAX_ATTEMPTS_JOBS = 25
retry_on Excon::Error::BadRequest
before_perform do |job|
Rails.logger.info("#{job.class.name} started at #{Time.zone.now}")
end
after_perform do |job|
Rails.logger.info("#{job.class.name} ended at #{Time.zone.now}")
end
def error(job, exception)
Raven.capture_exception(exception)
end
def max_attempts
ENV.fetch("MAX_ATTEMPTS_JOBS", DEFAULT_MAX_ATTEMPTS_JOBS).to_i
end
end