mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Proper logging when we bail on retrying after X attempts
This commit is contained in:
parent
8457e5eb1d
commit
f931290e58
1 changed files with 6 additions and 2 deletions
|
@ -28,8 +28,12 @@ module ActiveJob
|
||||||
# end
|
# end
|
||||||
def retry_on(exception, wait: 3.seconds, attempts: 5, queue: nil, priority: nil)
|
def retry_on(exception, wait: 3.seconds, attempts: 5, queue: nil, priority: nil)
|
||||||
rescue_from exception do |error|
|
rescue_from exception do |error|
|
||||||
logger.error "Retrying #{self.class} in #{wait} seconds, due to a #{exception}. The original exception was #{error.cause.inspect}."
|
if executions < attempts
|
||||||
retry_job wait: wait, queue: queue, priority: priority if executions < attempts
|
logger.error "Retrying #{self.class} in #{wait} seconds, due to a #{exception}. The original exception was #{error.cause.inspect}."
|
||||||
|
retry_job wait: wait, queue: queue, priority: priority
|
||||||
|
else
|
||||||
|
logger.error "Discarded #{self.class} due to a #{exception} which reoccurred on #{executions} attempts. The original exception was #{error.cause.inspect}."
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue