Skip to content

Commit

Permalink
feedback by Jeremy
Browse files Browse the repository at this point in the history
  • Loading branch information
sadasant authored Jun 25, 2021
1 parent fdd9ecf commit b561d19
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
19 changes: 9 additions & 10 deletions sdk/core/core-http/src/policies/throttlingRetryPolicy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,15 @@ export class ThrottlingRetryPolicy extends BaseRequestPolicy {
}

public async sendRequest(httpRequest: WebResourceLike): Promise<HttpOperationResponse> {
return this._nextPolicy.sendRequest(httpRequest.clone()).then((response) => {
if (
response.status !== StatusCodes.TooManyRequests &&
response.status !== StatusCodes.ServiceUnavailable
) {
return response;
} else {
return this._handleResponse(httpRequest, response);
}
});
const response = await this._nextPolicy.sendRequest(httpRequest.clone());
if (
response.status !== StatusCodes.TooManyRequests &&
response.status !== StatusCodes.ServiceUnavailable
) {
return response;
} else {
return this._handleResponse(httpRequest, response);
}
}

private async _defaultResponseHandler(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,6 @@ describe("ManagedIdentityCredential", function() {
});

it("IMDS MSI retries also retries on 503s", async function() {
process.env.AZURE_CLIENT_ID = "errclient";

const mockHttpClient = new MockAuthHttpClient({
// First response says the IMDS endpoint is available.
authResponse: [
Expand All @@ -274,7 +272,7 @@ describe("ManagedIdentityCredential", function() {
});

const credential = new ManagedIdentityCredential(
process.env.AZURE_CLIENT_ID,
"errclient",
mockHttpClient.tokenCredentialOptions
);

Expand Down

0 comments on commit b561d19

Please sign in to comment.