Skip to content
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

[core] Retry on 503 using the Retry-After header #15906

Merged
17 commits merged into from
Jun 29, 2021

Conversation

sadasant
Copy link
Contributor

Based on the Retry-After specification, 503 should also be supported when considering the Retry-After header.

This also aligns with upcoming Identity plans.

@sadasant sadasant requested review from xirzec and jeremymeng June 22, 2021 23:53
@ghost ghost added the Azure.Core label Jun 22, 2021
Copy link
Member

@xirzec xirzec left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@sadasant sadasant marked this pull request as ready for review June 22, 2021 23:56
@check-enforcer

This comment has been minimized.

@sadasant
Copy link
Contributor Author

@xirzec wait, won't the exponentialRetryPolicy and the throttlingRetryPolicy overlap 🤔

factories.push(exponentialRetryPolicy());
factories.push(systemErrorRetryPolicy());
factories.push(throttlingRetryPolicy());
like, the exponentialRetryPolicy will detect the 503s before the throttlingRetryPolicy 🤔

@sadasant sadasant requested a review from bterlson as a code owner June 23, 2021 03:17
@jeremymeng
Copy link
Member

jeremymeng commented Jun 23, 2021

@xirzec disregard! I understand now that lower in the code means that it will run first (since we wait for the next pipeline to run the current one).

We might want to remove 503 from exponentialRetryPolicy? Since we don't have total retry limit across retry policies, consecutive 503s could cause retires for both policies (not too bad, just taking longer to fail in the worst case).

@xirzec
Copy link
Member

xirzec commented Jun 23, 2021

We might want to remove 503 from exponentialRetryPolicy? Since we don't have total retry limit across retry policies, consecutive 503s could cause retires for both policies (not too bad, just taking longer to fail in the worst case).

Yeah, I'm good with removing it from the other policy. We really need to consolidate these soon. 😄

@sadasant
Copy link
Contributor Author

@xirzec @jeremymeng I’m writing some tests, I’ll write you directly after I push these changes

@sadasant sadasant marked this pull request as draft June 23, 2021 19:46
@sadasant

This comment has been minimized.

@sadasant sadasant requested a review from xirzec June 24, 2021 18:08
response.headers.get(Constants.HeaderConstants.RETRY_AFTER)
) {
return false;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I decided to put this in a separate conditional to make it easier to think through.

/**
* Maximum number of retries for the throttling retry policy
*/
export const DEFAULT_CLIENT_MAX_RETRY_COUNT = 3;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don’t believe we should preemptively expose this to the public API. If anything, now we retry up to 3 times on the throttlingRetryPolicy, while we were only retrying one time before.

Copy link
Member

Choose a reason for hiding this comment

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

Three is good, and is the same default value for exponential and system error retry policy.

@sadasant sadasant marked this pull request as ready for review June 24, 2021 18:15
@sadasant sadasant requested a review from schaabs as a code owner June 24, 2021 18:15
@sadasant sadasant requested a review from witemple-msft as a code owner June 24, 2021 18:15
@sadasant sadasant force-pushed the core/retry-on-503 branch from b215086 to 33260ec Compare June 25, 2021 19:01
@sadasant sadasant requested a review from jeremymeng June 28, 2021 13:50
Copy link
Member

@xirzec xirzec left a comment

Choose a reason for hiding this comment

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

A few comments, some minor bugs, but looks good once those are addressed

…y.ts

Co-authored-by: Jeff Fisher <xirzec@xirzec.com>
@ghost
Copy link

ghost commented Jun 29, 2021

Hello @sadasant!

Because this pull request has the auto-merge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@ghost ghost merged commit c8126be into Azure:main Jun 29, 2021
sadasant added a commit to sadasant/azure-sdk-for-js that referenced this pull request Jun 30, 2021
Based on the Retry-After specification, 503 should also be supported when considering the Retry-After header.

This also aligns with upcoming Identity plans.
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants