class Aws::Plugins::RetryErrors::Handler
Public Instance Methods
call(context)
click to toggle source
# File lib/aws-sdk-core/plugins/retry_errors.rb, line 87 def call(context) response = @handler.call(context) if response.error retry_if_possible(response) else response end end
Private Instance Methods
delay_retry(context)
click to toggle source
# File lib/aws-sdk-core/plugins/retry_errors.rb, line 122 def delay_retry(context) context.config.retry_backoff.call(context) end
error_for(response)
click to toggle source
# File lib/aws-sdk-core/plugins/retry_errors.rb, line 108 def error_for(response) status_code = response.context.http_response.status_code ErrorInspector.new(response.error, status_code) end
refreshable_credentials?(context)
click to toggle source
# File lib/aws-sdk-core/plugins/retry_errors.rb, line 140 def refreshable_credentials?(context) context.config.credentials.respond_to?(:refresh!) end
response_truncatable?(context)
click to toggle source
# File lib/aws-sdk-core/plugins/retry_errors.rb, line 148 def response_truncatable?(context) context.http_response.body.respond_to?(:truncate) end
retry_if_possible(response)
click to toggle source
# File lib/aws-sdk-core/plugins/retry_errors.rb, line 98 def retry_if_possible(response) context = response.context error = error_for(response) if should_retry?(context, error) retry_request(context, error) else response end end
retry_limit(context)
click to toggle source
# File lib/aws-sdk-core/plugins/retry_errors.rb, line 144 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 113 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
retryable?(context, error)
click to toggle source
# File lib/aws-sdk-core/plugins/retry_errors.rb, line 132 def retryable?(context, error) (error.expired_credentials? and refreshable_credentials?(context)) or error.throttling_error? or error.checksum? or error.networking? or error.server? end
should_retry?(context, error)
click to toggle source
# File lib/aws-sdk-core/plugins/retry_errors.rb, line 126 def should_retry?(context, error) retryable?(context, error) and context.retries < retry_limit(context) and response_truncatable?(context) end