Class: Tenax::Retry::Backoff::Strategy
- Inherits:
-
Object
- Object
- Tenax::Retry::Backoff::Strategy
- Defined in:
- lib/tenax/retry/backoff/strategy.rb
Overview
Abstract base class for backoff strategies.
Subclasses must implement #delay_for(attempt, previous_delay:).
The previous_delay argument is optional context: stateless
strategies (Constant, Linear, Exponential) ignore it; stateful
strategies (DecorrelatedJitter) use it.
Contract:
attemptis a 1-based integer (>= 1).previous_delayis the Float delay returned by the previous call in this retry sequence, or nil for the first call.- Return value is a Float number of seconds, never negative.
- Implementations must be thread-safe.
Direct Known Subclasses
Instance Method Summary collapse
-
#delay_for(attempt, previous_delay: nil) ⇒ Float
Non-negative seconds to wait before next attempt.
Instance Method Details
#delay_for(attempt, previous_delay: nil) ⇒ Float
Returns non-negative seconds to wait before next attempt.
24 25 26 |
# File 'lib/tenax/retry/backoff/strategy.rb', line 24 def delay_for(attempt, previous_delay: nil) raise NotImplementedError, "#{self.class}#delay_for must be implemented" end |