1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Reraise instead of swallow exceptions that occur beyond the retry attempts

This commit is contained in:
David Heinemeier Hansson 2016-07-29 15:15:31 -07:00
parent f931290e58
commit 779148d390
2 changed files with 3 additions and 2 deletions

View file

@ -32,7 +32,8 @@ module ActiveJob
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}."
logger.error "Stopped retrying #{self.class} due to a #{exception}, which reoccurred on #{executions} attempts. The original exception was #{error.cause.inspect}."
raise error
end
end
end

View file

@ -35,7 +35,7 @@ class ExceptionsTest < ActiveSupport::TestCase
begin
RetryJob.perform_later 'VerySeriousError', 11
assert_equal "Raised VerySeriousError for the 10th time", JobBuffer.last_value
rescue SeriousError
rescue VerySeriousError
pass
end
end