Class: ManageIQ::Floe::Workflow::Retrier
- Inherits:
-
Object
- Object
- ManageIQ::Floe::Workflow::Retrier
- Defined in:
- lib/manageiq/floe/workflow/retrier.rb
Instance Attribute Summary collapse
-
#backoff_rate ⇒ Object
readonly
Returns the value of attribute backoff_rate.
-
#error_equals ⇒ Object
readonly
Returns the value of attribute error_equals.
-
#interval_seconds ⇒ Object
readonly
Returns the value of attribute interval_seconds.
-
#max_attempts ⇒ Object
readonly
Returns the value of attribute max_attempts.
Instance Method Summary collapse
-
#initialize(payload) ⇒ Retrier
constructor
A new instance of Retrier.
- #sleep_duration(attempt) ⇒ Object
Constructor Details
#initialize(payload) ⇒ Retrier
Returns a new instance of Retrier.
9 10 11 12 13 14 15 16 |
# File 'lib/manageiq/floe/workflow/retrier.rb', line 9 def initialize(payload) @payload = payload @error_equals = payload["ErrorEquals"] @interval_seconds = payload["IntervalSeconds"] || 1.0 @max_attempts = payload["MaxAttempts"] || 3 @backoff_rate = payload["BackoffRate"] || 2.0 end |
Instance Attribute Details
#backoff_rate ⇒ Object (readonly)
Returns the value of attribute backoff_rate.
7 8 9 |
# File 'lib/manageiq/floe/workflow/retrier.rb', line 7 def backoff_rate @backoff_rate end |
#error_equals ⇒ Object (readonly)
Returns the value of attribute error_equals.
7 8 9 |
# File 'lib/manageiq/floe/workflow/retrier.rb', line 7 def error_equals @error_equals end |
#interval_seconds ⇒ Object (readonly)
Returns the value of attribute interval_seconds.
7 8 9 |
# File 'lib/manageiq/floe/workflow/retrier.rb', line 7 def interval_seconds @interval_seconds end |
#max_attempts ⇒ Object (readonly)
Returns the value of attribute max_attempts.
7 8 9 |
# File 'lib/manageiq/floe/workflow/retrier.rb', line 7 def max_attempts @max_attempts end |
Instance Method Details
#sleep_duration(attempt) ⇒ Object
18 19 20 |
# File 'lib/manageiq/floe/workflow/retrier.rb', line 18 def sleep_duration(attempt) interval_seconds * (backoff_rate * attempt) end |