diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2016-07-29 15:07:50 -0700 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2016-07-29 15:07:50 -0700 |
commit | f931290e58b2e62b56eca55b1ef45c794886e6cb (patch) | |
tree | 5bd7db6a4b2143926afddbe2bfe47beea5c01e56 /activejob/lib/active_job/exceptions.rb | |
parent | 8457e5eb1dfad9a41ac44547ae4d96f3475570dc (diff) | |
download | rails-f931290e58b2e62b56eca55b1ef45c794886e6cb.tar.gz rails-f931290e58b2e62b56eca55b1ef45c794886e6cb.tar.bz2 rails-f931290e58b2e62b56eca55b1ef45c794886e6cb.zip |
Proper logging when we bail on retrying after X attempts
Diffstat (limited to 'activejob/lib/active_job/exceptions.rb')
-rw-r--r-- | activejob/lib/active_job/exceptions.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/activejob/lib/active_job/exceptions.rb b/activejob/lib/active_job/exceptions.rb index 006b067bcf..eead8daae3 100644 --- a/activejob/lib/active_job/exceptions.rb +++ b/activejob/lib/active_job/exceptions.rb @@ -28,8 +28,12 @@ module ActiveJob # end def retry_on(exception, wait: 3.seconds, attempts: 5, queue: nil, priority: nil) rescue_from exception do |error| - 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 if executions < attempts + 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 |