Class: Aws::Plugins::RetryErrors::Handler Private
- Inherits:
-
Seahorse::Client::Handler
- Object
- Seahorse::Client::Handler
- Aws::Plugins::RetryErrors::Handler
- 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- LONG_POLLING_OPERATIONS =
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.
TODO: remove once longPoll trait is added to models Hard-coded combination of services and operations as having the longPoll trait. To be removed when trait is enabled.
{ 'SQS' => Set[:receive_message], 'SFN' => Set[:get_activity_task], 'SWF' => Set[:poll_for_activity_task, :poll_for_decision_task] }.freeze
Instance Attribute Summary
Attributes inherited from Seahorse::Client::Handler
Instance Method Summary collapse
- #call(context) ⇒ Object private
Methods inherited from Seahorse::Client::Handler
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.
264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 |
# File 'lib/aws-sdk-core/plugins/retry_errors.rb', line 264 def call(context) context.[:retries] ||= {} config = context.config get_send_token(config) add_retry_headers(context) response = with_metric(config.retry_mode) { @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 capacity_amount = config.retry_quota.checkout_capacity(error_inspector) context.[:retries][:capacity_amount] = capacity_amount # TODO: Remove gate and keep only the new retries branch if new_retries? return response if capacity_amount <= 0 && !long_polling_operation?(context) service_id = context.config.api.['serviceId'] delay = backoff(context, error_inspector, service_id) Kernel.sleep(delay) return response if capacity_amount <= 0 else return response unless capacity_amount > 0 delay = exponential_backoff(context.retries) Kernel.sleep(delay) end retry_request(context, error_inspector) end |