28 lines
736 B
Ruby
28 lines
736 B
Ruby
# typed: false
|
|
class ApplicationJob < ActiveJob::Base
|
|
include GoodJob::ActiveJobExtensions::Concurrency
|
|
include HasColorLogger
|
|
|
|
retry_on(
|
|
StandardError,
|
|
wait: :polynomially_longer,
|
|
attempts: Float::INFINITY
|
|
) do |job, exception|
|
|
job.logger.error(
|
|
"error: #{exception.message}\n#{exception.backtrace.join("\n")}"
|
|
)
|
|
end
|
|
|
|
# Automatically retry jobs that encountered a deadlock
|
|
# retry_on ActiveRecord::Deadlocked
|
|
|
|
# Most jobs are safe to ignore if the underlying records are no longer available
|
|
# discard_on ActiveJob::DeserializationError
|
|
|
|
def self.ignore_signature_args(*args)
|
|
@ignore_signature_args ||= []
|
|
@ignore_signature_args += (args || [])
|
|
@ignore_signature_args
|
|
end
|
|
end
|