Class: Aws::Plugins::RetryErrors::Handler Private

Inherits:
Seahorse::Client::Handler show all
Defined in:
lib/aws-sdk-core/plugins/retry_errors.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Constant Summary collapse

MAX_BACKOFF =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Max backoff (in seconds)

20

Instance Attribute Summary

Attributes inherited from Seahorse::Client::Handler

#handler

Instance Method Summary collapse

Methods inherited from Seahorse::Client::Handler

#initialize, #inspect

Constructor Details

This class inherits a constructor from Seahorse::Client::Handler

Instance Method Details

#call(context) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
# File 'lib/aws-sdk-core/plugins/retry_errors.rb', line 232

def call(context)
  context.[: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.[:retries][:capacity_amount] =
    config.retry_quota.checkout_capacity(error_inspector)
  return response unless context.[:retries][:capacity_amount] > 0

  delay = exponential_backoff(context.retries)
  Kernel.sleep(delay)
  retry_request(context, error_inspector)
end