Class: Cadence::RetryPolicy
- Inherits:
-
Struct
- Object
- Struct
- Cadence::RetryPolicy
- Defined in:
- lib/cadence/retry_policy.rb
Defined Under Namespace
Classes: InvalidRetryPolicy
Instance Attribute Summary collapse
-
#backoff ⇒ Object
Returns the value of attribute backoff.
-
#expiration_interval ⇒ Object
Returns the value of attribute expiration_interval.
-
#interval ⇒ Object
Returns the value of attribute interval.
-
#max_attempts ⇒ Object
Returns the value of attribute max_attempts.
-
#max_interval ⇒ Object
Returns the value of attribute max_interval.
-
#non_retriable_errors ⇒ Object
Returns the value of attribute non_retriable_errors.
Instance Method Summary collapse
Instance Attribute Details
#backoff ⇒ Object
Returns the value of attribute backoff
4 5 6 |
# File 'lib/cadence/retry_policy.rb', line 4 def backoff @backoff end |
#expiration_interval ⇒ Object
Returns the value of attribute expiration_interval
4 5 6 |
# File 'lib/cadence/retry_policy.rb', line 4 def expiration_interval @expiration_interval end |
#interval ⇒ Object
Returns the value of attribute interval
4 5 6 |
# File 'lib/cadence/retry_policy.rb', line 4 def interval @interval end |
#max_attempts ⇒ Object
Returns the value of attribute max_attempts
4 5 6 |
# File 'lib/cadence/retry_policy.rb', line 4 def max_attempts @max_attempts end |
#max_interval ⇒ Object
Returns the value of attribute max_interval
4 5 6 |
# File 'lib/cadence/retry_policy.rb', line 4 def max_interval @max_interval end |
#non_retriable_errors ⇒ Object
Returns the value of attribute non_retriable_errors
4 5 6 |
# File 'lib/cadence/retry_policy.rb', line 4 def non_retriable_errors @non_retriable_errors end |
Instance Method Details
#validate! ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/cadence/retry_policy.rb', line 9 def validate! unless interval && backoff raise InvalidRetryPolicy, 'interval and backoff must be set' end unless max_attempts || expiration_interval raise InvalidRetryPolicy, 'max_attempts or expiration_interval must be set' end unless [interval, max_interval, expiration_interval].compact.all? { |arg| arg.is_a?(Integer) } raise InvalidRetryPolicy, 'All intervals must be specified in whole seconds' end unless [interval, max_interval, expiration_interval].compact.all? { |arg| arg > 0 } raise InvalidRetryPolicy, 'All intervals must be greater than 0' end end |