Module: BarbequeClient::Retryable::ClassMethods
- Defined in:
- lib/barbeque_client/retryable.rb
Instance Method Summary collapse
Instance Method Details
#barbeque_retry(limit:, retryable_exceptions: nil) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/barbeque_client/retryable.rb', line 10 def (limit:, retryable_exceptions: nil) exceptions = Array.wrap(retryable_exceptions || StandardError) rescue_from *exceptions do |exception| unless ENV['BARBEQUE_RETRY_COUNT'] raise EmptyRetryCount.new('ENV["BARBEQUE_RETRY_COUNT"] is not set') end count = ENV['BARBEQUE_RETRY_COUNT'].to_i if count < limit ExponentialRetry.new(count).retry(self.job_id) else raise exception end end end |