-
Notifications
You must be signed in to change notification settings - Fork 586
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
feat(middleware-retry) add RetryStrategyV2 #4248
Conversation
const retryAfter = response.headers[retryAfterHeaderName]; | ||
|
||
const retryAfterSeconds = Number(retryAfter); | ||
const retryAfterDate = new Date(retryAfter); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the line above implies retryAfter is a seconds unit, but then you initialize a Date with it?
Is retryAfter
seconds or milliseconds?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
below you multiply by 1000, so shouldn't this also be x1000?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was patterned off of this logic in the current StandardRetryStrategy. retyAfter
should be a string of the number of seconds, but if it isn't a number, we let new Date()
parse the raw retryAfter
string.
export const isServerError = (error: SdkError) => { | ||
if (error.$metadata?.httpStatusCode !== undefined) { | ||
const statusCode = error.$metadata.httpStatusCode; | ||
if (statusCode > 499 && statusCode <= 599 && !isTransientError(error)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (statusCode > 499 && statusCode <= 599 && !isTransientError(error)) { | |
if (500 <= statusCode && statusCode <= 599 && !isTransientError(error)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 071e6b1.
How was this change tested? |
978aab3
to
a8d783d
Compare
Integration tests were added to |
a8d783d
to
0a328e8
Compare
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. |
Issue
This PR updates the middleware-retry to use the RetryStrategyV2 and its implementation added in #4224.
Clients are updated to pull in retry related configuration values that were moved from
middleware-rety
toutil-retry
.Description
The retry middleware will now use the new
RetryStrategyV2
implementation that was added in #4224. For customers that have previously implemented and configured aRetryStrategy
, the middleware will continue to use that strategy.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.