Skip to content

feat(retries): SRA retries #4187

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed

feat(retries): SRA retries #4187

wants to merge 4 commits into from

Conversation

srchase
Copy link
Contributor

@srchase srchase commented Nov 14, 2022

Issue

Draft PR that adds a new package, util-retry, which adds StandardRetryStrategy and AdaptiveRetryStrategy.

middleware-retry is updated with new configuration resolution, and the middleware itself prefers the new strategies, while the existing strategies are deprecated.

This is a draft only as the clients have not been updated to use the new retry strategy. Once this has been reviewed, the PR will be updated to add the client codegen changes.

Description

What does this implement/fix? Explain your changes.

Testing

How was this change tested?

Additional context

Add any other context about the PR here.


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@srchase srchase requested a review from a team as a code owner November 14, 2022 16:26
@srchase srchase changed the title Sra retries feat(retries): SRA retries Nov 14, 2022
@srchase srchase marked this pull request as draft November 14, 2022 16:43
"tslib": "^2.3.1",
"uuid": "^8.3.2"
},
"devDependencies": {
"@aws-sdk/node-config-provider": "*",
"@aws-sdk/util-retry": "*",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't need this in devDeps, should be deps only

export const isServerError = (error: SdkError) => {
if (error.$metadata?.httpStatusCode !== undefined) {
const statusCode = error.$metadata.httpStatusCode;
if (statusCode > 500 && statusCode <= 599 && !isTransientError(error)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this include 500 itself?

DEFAULT = "Default",
NONE = "None",
FULL = "Full",
DECORRELATED = "Decorrelated",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about setting the enum string values equal their variable names?

export class AdaptiveRetryStrategy implements RetryStrategyV2 {
private rateLimiter: RateLimiter;
private standardRetryStrategy: StandardRetryStrategy;
public mode: string = RETRY_MODES.ADAPTIVE;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this sounds like it should be readonly

return this.standardRetryStrategy.refreshRetryTokenForRetry(tokenToRenew, errorInfo);
}

recordSuccess(token: StandardRetryToken): void {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use explicit access modifier public


export class StandardRetryStrategy implements RetryStrategyV2 {
private retryToken: StandardRetryToken;
public mode: string = RETRY_MODES.STANDARD;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

readonly?

const attempts = tokenToRenew.getRetryCount();
return (
attempts < maxAttempts &&
attempts < DEFAULT_MAX_ATTEMPTS &&
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should not include DEFAULT_MAX_ATTEMPTS unless it also means ABSOLUTE_MAX_ATTEMPTS a.k.a.

MAX_MAX_ATTEMPTS

@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 24, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants