retry exponentially on api entreprise timeout

This commit is contained in:
simon lehericey 2020-12-03 10:39:51 +01:00
parent 78a40b5176
commit f56235c7ee
4 changed files with 17 additions and 2 deletions

View file

@ -29,6 +29,13 @@ RSpec.describe ApiEntreprise::Job, type: :job do
it { subject }
end
context 'when it is timed out' do
let(:error) { :timed_out }
let(:try) { 5 }
it { subject }
end
end
class ExceptionJob < ApiEntreprise::Job
@ -38,6 +45,8 @@ RSpec.describe ApiEntreprise::Job, type: :job do
raise ApiEntreprise::API::ServiceUnavailable
when :bad_gateway
raise ApiEntreprise::API::BadGateway
when :timed_out
raise ApiEntreprise::API::TimedOut
else
raise StandardError
end