Class: Philiprehberger::RetryKit::Executor
- Inherits:
-
Object
- Object
- Philiprehberger::RetryKit::Executor
- Defined in:
- lib/philiprehberger/retry_kit/executor.rb
Instance Attribute Summary collapse
-
#last_attempts ⇒ Object
readonly
Returns the value of attribute last_attempts.
-
#last_total_delay ⇒ Object
readonly
Returns the value of attribute last_total_delay.
Instance Method Summary collapse
- #call(&block) ⇒ Object
-
#initialize(**options) ⇒ Executor
constructor
A new instance of Executor.
Constructor Details
#initialize(**options) ⇒ Executor
Returns a new instance of Executor.
8 9 10 11 12 |
# File 'lib/philiprehberger/retry_kit/executor.rb', line 8 def initialize(**) () @last_attempts = 0 @last_total_delay = 0.0 end |
Instance Attribute Details
#last_attempts ⇒ Object (readonly)
Returns the value of attribute last_attempts.
6 7 8 |
# File 'lib/philiprehberger/retry_kit/executor.rb', line 6 def last_attempts @last_attempts end |
#last_total_delay ⇒ Object (readonly)
Returns the value of attribute last_total_delay.
6 7 8 |
# File 'lib/philiprehberger/retry_kit/executor.rb', line 6 def last_total_delay @last_total_delay end |
Instance Method Details
#call(&block) ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/philiprehberger/retry_kit/executor.rb', line 14 def call(&block) raise ArgumentError, 'Block required' unless block @last_attempts = 0 @last_total_delay = 0.0 @last_decorrelated_delay = @base_delay @start_time = @total_timeout ? Process.clock_gettime(Process::CLOCK_MONOTONIC) : nil attempt_with_retries(0, &block) end |