class Aws::Plugins::RetryErrors::LegacyHandler

Public Instance Methods

call(context) click to toggle source
# File lib/aws-sdk-core/plugins/retry_errors.rb, line 354
def call(context)
  response = @handler.call(context)
  if response.error
    error_inspector = Retries::ErrorInspector.new(
      response.error, response.context.http_response.status_code
    )

    if error_inspector.endpoint_discovery?(context)
      key = context.config.endpoint_cache.extract_key(context)
      context.config.endpoint_cache.delete(key)
    end

    retry_if_possible(response, error_inspector)
  else
    response
  end
end

Private Instance Methods

delay_retry(context) click to toggle source
# File lib/aws-sdk-core/plugins/retry_errors.rb, line 392
def delay_retry(context)
  context.config.retry_backoff.call(context)
end
response_truncatable?(context) click to toggle source
# File lib/aws-sdk-core/plugins/retry_errors.rb, line 406
def response_truncatable?(context)
  context.http_response.body.respond_to?(:truncate)
end
retry_if_possible(response, error_inspector) click to toggle source
# File lib/aws-sdk-core/plugins/retry_errors.rb, line 374
def retry_if_possible(response, error_inspector)
  context = response.context
  if should_retry?(context, error_inspector)
    retry_request(context, error_inspector)
  else
    response
  end
end
retry_limit(context) click to toggle source
# File lib/aws-sdk-core/plugins/retry_errors.rb, line 402
def retry_limit(context)
  context.config.retry_limit
end
retry_request(context, error) click to toggle source
# File lib/aws-sdk-core/plugins/retry_errors.rb, line 383
def retry_request(context, error)
  delay_retry(context)
  context.retries += 1
  context.config.credentials.refresh! if error.expired_credentials?
  context.http_request.body.rewind
  context.http_response.reset
  call(context)
end
should_retry?(context, error) click to toggle source
# File lib/aws-sdk-core/plugins/retry_errors.rb, line 396
def should_retry?(context, error)
  error.retryable?(context) &&
    context.retries < retry_limit(context) &&
    response_truncatable?(context)
end