Retry Classifier Customization Guidance #3050
Velfi
announced in
Change Log
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
How the orchestrator models retries
A Retry Strategy is the process by which the orchestrator determines when and how to retry failed requests. Only one retry strategy may be set at any given time. During its operation, the retry strategy relies on a series of Retry Classifiers to determine if and how a failed request should be retried.
Retry classifiers each have a Retry Classifier Priority so that regardless of whether they are set during config or operation construction, they'll always run in a consistent order. Classifiers are each run in turn by the retry strategy. In general, it's better to write retry classifiers that don't conflict with each other and to just use the default priority.
The following example demonstrates how to implement and set an operation-specific retry classifier:
Generally speaking, classifiers that require knowledge of a specific operation error type should set at the operation level. Otherwise, they'll be run against errors that they can never classify, wasting effort. Classifiers that don't require specific types or that only act on the HTTP response should be set at the service config level.
Default Classifiers
Smithy clients have three classifiers enabled by default:
ModeledAsRetryableClassifier
: Checks for errors that are marked as retryable in the smithy model. If one is encountered, returnsSome(RetryAction::Retry(ErrorKind))
. Otherwise, returnsNone
. Requires a parsed response.TransientErrorClassifier
: Checks for timeout, IO, and connector errors. If one is encountered, returnsSome(RetryAction::Retry(ErrorKind::TransientError))
. Otherwise, returnsNone
. Requires a parsed response.HttpStatusCodeClassifier
: Checks the HTTP response's status code. By default this classifies500
,502
,503
, and504
errors asSome(RetryAction::Retry(ErrorKind::TransientError))
. Otherwise, returnsNone
. The list of retryable status codes may be customized when creating this classifier with theHttpStatusCodeClassifier::new_from_codes
method.AWS clients enable the three smithy classifiers as well as one more by default:
AwsErrorCodeClassifier
: Checks for errors with AWS error codes marking them as either transient or throttling errors. If one is encountered, returnsSome(RetryAction::Retry(ErrorKind))
. Otherwise, returnsNone
. Requires a parsed response. This classifier will also check the HTTP response for anx-amz-retry-after
header. If one is set, the retry will be attempted after a the specified delay.The priority order of these classifiers is as follows:
TransientErrorClassifier
ModeledAsRetryableClassifier
AwsErrorCodeClassifier
HttpStatusCodeClassifier
Beta Was this translation helpful? Give feedback.
All reactions