Sha256: 9470c23d2558e2db7da75000b0b1258eccb24480e0b3d44cfeefb6b324ad01b0

Contents?: true

Size: 524 Bytes

Versions: 6

Compression:

Stored size: 524 Bytes

Contents

module ProconBypassMan
  class Retryable
    def self.retryable(tries: , retried: 0, on_no_retry: [], log_label: nil, interval_on_retry: 0)
      return yield(retried)
    rescue *on_no_retry
      raise
    rescue => e
      if tries <= retried
        raise
      else
        retried = retried + 1
        ProconBypassMan.logger.debug "[Retryable]#{log_label && "[#{log_label}]"} #{e}が起きました。retryします。#{retried} / #{tries}"

        sleep(interval_on_retry)
        retry
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
procon_bypass_man-0.3.12 lib/procon_bypass_man/support/retryable.rb
procon_bypass_man-0.3.11 lib/procon_bypass_man/support/retryable.rb
procon_bypass_man-0.3.10 lib/procon_bypass_man/support/retryable.rb
procon_bypass_man-0.3.9 lib/procon_bypass_man/support/retryable.rb
procon_bypass_man-0.3.8.1 lib/procon_bypass_man/support/retryable.rb
procon_bypass_man-0.3.8 lib/procon_bypass_man/support/retryable.rb