Class: Gapic::Operation::RetryPolicy
- Inherits:
-
Object
- Object
- Gapic::Operation::RetryPolicy
- Defined in:
- lib/gapic/operation/retry_policy.rb
Overview
The policy for retrying operation reloads using an incremental backoff. A new object instance should be used for every Operation invocation.
Instance Method Summary collapse
- #call ⇒ Object
- #initial_delay ⇒ Object
-
#initialize(initial_delay: nil, multiplier: nil, max_delay: nil, timeout: nil) ⇒ RetryPolicy
constructor
Create new Operation RetryPolicy.
- #max_delay ⇒ Object
- #multiplier ⇒ Object
- #timeout ⇒ Object
Constructor Details
#initialize(initial_delay: nil, multiplier: nil, max_delay: nil, timeout: nil) ⇒ RetryPolicy
Create new Operation RetryPolicy.
30 31 32 33 34 35 36 |
# File 'lib/gapic/operation/retry_policy.rb', line 30 def initialize initial_delay: nil, multiplier: nil, max_delay: nil, timeout: nil @initial_delay = initial_delay @multiplier = multiplier @max_delay = max_delay @timeout = timeout @delay = nil end |
Instance Method Details
#call ⇒ Object
54 55 56 57 58 59 60 61 |
# File 'lib/gapic/operation/retry_policy.rb', line 54 def call return unless retry? delay! increment_delay! true end |
#initial_delay ⇒ Object
38 39 40 |
# File 'lib/gapic/operation/retry_policy.rb', line 38 def initial_delay @initial_delay || 10 end |
#max_delay ⇒ Object
46 47 48 |
# File 'lib/gapic/operation/retry_policy.rb', line 46 def max_delay @max_delay || 300 # Five minutes end |
#multiplier ⇒ Object
42 43 44 |
# File 'lib/gapic/operation/retry_policy.rb', line 42 def multiplier @multiplier || 1.3 end |
#timeout ⇒ Object
50 51 52 |
# File 'lib/gapic/operation/retry_policy.rb', line 50 def timeout @timeout || 3600 # One hour end |