class Aws::Plugins::RetryErrors::LegacyHandler
Public Instance Methods
call(context)
click to toggle source
# File lib/aws-sdk-core/plugins/retry_errors.rb, line 364 def call(context) response = with_metric { @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 406 def delay_retry(context) context.config.retry_backoff.call(context) end
refresh_credentials?(context, error)
click to toggle source
# File lib/aws-sdk-core/plugins/retry_errors.rb, line 416 def refresh_credentials?(context, error) error.expired_credentials? && context.config.credentials.respond_to?(:refresh!) end
response_truncatable?(context)
click to toggle source
# File lib/aws-sdk-core/plugins/retry_errors.rb, line 425 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 388 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 421 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 397 def retry_request(context, error) delay_retry(context) context.retries += 1 context.config.credentials.refresh! if refresh_credentials?(context, error) 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 410 def should_retry?(context, error) error.retryable?(context) && context.retries < retry_limit(context) && response_truncatable?(context) end
with_metric(&block)
click to toggle source
# File lib/aws-sdk-core/plugins/retry_errors.rb, line 384 def with_metric(&block) Aws::Plugins::UserAgent.metric('RETRY_MODE_LEGACY', &block) end