Class: Fractor::Workflow::RetryStrategy
- Inherits:
-
Object
- Object
- Fractor::Workflow::RetryStrategy
- Defined in:
- lib/fractor/workflow/retry_strategy.rb
Overview
Base class for retry strategies
Direct Known Subclasses
Instance Attribute Summary collapse
-
#max_attempts ⇒ Object
readonly
Returns the value of attribute max_attempts.
-
#max_delay ⇒ Object
readonly
Returns the value of attribute max_delay.
Instance Method Summary collapse
-
#delay_for(attempt) ⇒ Numeric
Calculate delay for the given attempt number.
-
#initialize(max_attempts: 3, max_delay: nil) ⇒ RetryStrategy
constructor
A new instance of RetryStrategy.
Constructor Details
#initialize(max_attempts: 3, max_delay: nil) ⇒ RetryStrategy
Returns a new instance of RetryStrategy.
9 10 11 12 |
# File 'lib/fractor/workflow/retry_strategy.rb', line 9 def initialize(max_attempts: 3, max_delay: nil) @max_attempts = max_attempts @max_delay = max_delay end |
Instance Attribute Details
#max_attempts ⇒ Object (readonly)
Returns the value of attribute max_attempts.
7 8 9 |
# File 'lib/fractor/workflow/retry_strategy.rb', line 7 def max_attempts @max_attempts end |
#max_delay ⇒ Object (readonly)
Returns the value of attribute max_delay.
7 8 9 |
# File 'lib/fractor/workflow/retry_strategy.rb', line 7 def max_delay @max_delay end |
Instance Method Details
#delay_for(attempt) ⇒ Numeric
Calculate delay for the given attempt number
17 18 19 |
# File 'lib/fractor/workflow/retry_strategy.rb', line 17 def delay_for(attempt) raise NotImplementedError, "Subclasses must implement delay_for" end |