class Aws::Plugins::RetryErrors::Handler

def call(context)

def call(context)
  context.metadata[:retries] ||= {}
  config = context.config
  get_send_token(config)
  add_retry_headers(context)
  response = @handler.call(context)
  error_inspector = Retries::ErrorInspector.new(
    response.error, response.context.http_response.status_code
  )
  request_bookkeeping(context, response, error_inspector)
  if error_inspector.endpoint_discovery?(context)
    key = config.endpoint_cache.extract_key(context)
    config.endpoint_cache.delete(key)
  end
  # Clock correction needs to be updated from the response even when
  # the request is not retryable but should only be updated
  # in the case of clock skew errors
  if error_inspector.clock_skew?(context)
    config.clock_skew.update_clock_correction(context)
  end
  # Estimated skew needs to be updated on every request
  config.clock_skew.update_estimated_skew(context)
  return response unless retryable?(context, response, error_inspector)
  return response if context.retries >= config.max_attempts - 1
  context.metadata[:retries][:capacity_amount] =
    config.retry_quota.checkout_capacity(error_inspector)
  return response unless context.metadata[:retries][:capacity_amount] > 0
  delay = exponential_backoff(context.retries)
  Kernel.sleep(delay)
  retry_request(context, error_inspector)
end