class Gapic::Operation::RetryPolicy


every Operation invocation.
The policy for retrying operation reloads using an incremental backoff. A new object instance should be used for
#

def call

def call
  return unless retry?
  delay!
  increment_delay!
  true
end

def deadline

def deadline
  # memoize the deadline
  @deadline ||= Time.now + timeout
end

def delay

The current delay value.
#
def delay
  @delay || initial_delay
end

def delay!

def delay!
  # Call Kernel.sleep so we can stub it.
  Kernel.sleep delay
end

def increment_delay!

Calculate and set the next delay value.
#
def increment_delay!
  @delay = [delay * multiplier, max_delay].min
end

def initial_delay

def initial_delay
  @initial_delay || 10
end

def initialize initial_delay: nil, multiplier: nil, max_delay: nil, timeout: nil

Parameters:
  • timeout (Numeric) -- client-side timeout
  • max_delay (Numeric) -- client-side timeout
  • multiplier (Numeric) -- client-side timeout
  • initial_delay (Numeric) -- client-side timeout
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

def max_delay

def max_delay
  @max_delay || 300 # Five minutes
end

def multiplier

def multiplier
  @multiplier || 1.3
end

def retry?

def retry?
  deadline > Time.now
end

def timeout

def timeout
  @timeout || 3600 # One hour
end