Class: Tenax::Retry::Backoff::Constant
- Defined in:
- lib/tenax/retry/backoff/constant.rb
Overview
Constant delay between retry attempts.
Returns interval seconds for every attempt, regardless of attempt
number.
Instance Method Summary collapse
-
#delay_for(_attempt) ⇒ Float
The configured interval.
-
#initialize(interval:) ⇒ Constant
constructor
A new instance of Constant.
Constructor Details
#initialize(interval:) ⇒ Constant
Returns a new instance of Constant.
20 21 22 23 24 25 26 |
# File 'lib/tenax/retry/backoff/constant.rb', line 20 def initialize(interval:) raise ArgumentError, "interval must be non-negative, got #{interval}" if interval.negative? super() @interval = interval.to_f freeze end |
Instance Method Details
#delay_for(_attempt) ⇒ Float
Returns the configured interval.
30 31 32 |
# File 'lib/tenax/retry/backoff/constant.rb', line 30 def delay_for(_attempt, **) @interval end |