Sha256: 5389cc7607bb6ec1fb4a986f96e5382d9f2338317a49ce7a4eee395c5ff712cc
Contents?: true
Size: 746 Bytes
Versions: 9
Compression:
Stored size: 746 Bytes
Contents
require 'barbeque_client/exponential_retry' module BarbequeClient module Retryable extend ActiveSupport::Concern class EmptyRetryCount < StandardError; end module ClassMethods def barbeque_retry(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 end end end
Version data entries
9 entries across 9 versions & 1 rubygems