Class: Bogo::Retry::Exponential

Inherits:
Bogo::Retry show all
Defined in:
lib/bogo/retry.rb

Overview

Exponential retry implementation

Instance Attribute Summary collapse

Attributes inherited from Bogo::Retry

#action, #attempts, #dead, #description, #max_attempts, #ui

Instance Method Summary collapse

Methods inherited from Bogo::Retry

build, #retries, #run!

Constructor Details

#initialize(args = {}, &block) ⇒ self

Create a new linear retry instance

Parameters:

  • args (Hash) (defaults to: {})

Options Hash (args):

  • :wait_interval (Numeric)

    Defaults to 5 seconds

  • :wait_exponent (Numeric)

    Defaults to 2



181
182
183
184
185
186
187
188
189
190
191
# File 'lib/bogo/retry.rb', line 181

def initialize(args={}, &block)
  @wait_interval = args[:wait_interval].to_f
  @wait_exponent = args[:wait_exponent].to_f
  unless(@wait_interval > 0)
    @wait_interval = 5
  end
  unless(@wait_exponent > 0)
    @wait_exponent = 2
  end
  super
end

Instance Attribute Details

#wait_exponentNumeric (readonly)

Returns:

  • (Numeric)


173
174
175
# File 'lib/bogo/retry.rb', line 173

def wait_exponent
  @wait_exponent
end

#wait_intervalNumeric (readonly)

Returns:

  • (Numeric)


171
172
173
# File 'lib/bogo/retry.rb', line 171

def wait_interval
  @wait_interval
end