Sha256: 18990bb3b0004cbd1d57fdd10797e762d5f377cf425fc2df6a5c125e9e36b2b7

Contents?: true

Size: 847 Bytes

Versions: 3

Compression:

Stored size: 847 Bytes

Contents

module Fog
  @interval = lambda { |retries| [2**(retries - 1), @max_interval].min }

  class << self
    attr_reader :interval
  end

  def self.interval=(interval)
    if interval.is_a?(Proc)
      raise ArgumentError, "interval proc must return a positive" unless interval.call(1) >= 0
    else
      raise ArgumentError, "interval must be non-negative" unless interval >= 0
    end
    @interval = interval
  end

  @timeout = 600

  class << self
    attr_reader :timeout
  end

  def self.timeout=(timeout)
    raise ArgumentError, "timeout must be non-negative" unless timeout >= 0

    @timeout = timeout
  end

  @max_interval = 60

  class << self
    attr_reader :max_interval
  end

  def self.max_interval=(interval)
    raise ArgumentError, "interval must be non-negative" unless interval >= 0

    @max_interval = interval
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fog-core-2.6.0 lib/fog/core/wait_for_defaults.rb
fog-core-2.5.0 lib/fog/core/wait_for_defaults.rb
fog-core-2.4.0 lib/fog/core/wait_for_defaults.rb