Sha256: 3bea318936add5eee739a5f36e3edbc631a03ecdaa342301791558ed16a0634e
Contents?: true
Size: 466 Bytes
Versions: 5
Compression:
Stored size: 466 Bytes
Contents
# frozen_string_literal: true module Retry DEFAULT_MAX_NO_OF_RETRIES = 2 DEFAULT_RESCUE_ERRORS = StandardError def self.call(no_of_retries: DEFAULT_MAX_NO_OF_RETRIES, rescue_errors: DEFAULT_RESCUE_ERRORS, &blk) total_attempts = 0 begin blk.call rescue rescue_errors => ex total_attempts += 1 retry if total_attempts < no_of_retries ensure if total_attempts == no_of_retries return end end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
flex_commerce_api-0.8.3 | lib/retry.rb |
flex_commerce_api-0.8.2 | lib/retry.rb |
flex_commerce_api-0.8.1 | lib/retry.rb |
flex_commerce_api-0.7 | lib/retry.rb |
flex_commerce_api-0.6.57 | lib/retry.rb |