From 60665324c4ae1694576353c9af69199fe1c2105f Mon Sep 17 00:00:00 2001 From: Harsha Nalluru Date: Wed, 14 Jul 2021 02:58:37 +0000 Subject: [PATCH 01/11] app-config throttlign retry policy fix - no retrying forever --- .../review/app-configuration.api.md | 2 + .../src/appConfigurationClient.ts | 10 +++- .../src/policies/throttlingRetryPolicy.ts | 38 +++++++++++--- .../node/throttlingRetryPolicy.spec.ts | 49 +++++++++++++++++-- 4 files changed, 86 insertions(+), 13 deletions(-) diff --git a/sdk/appconfiguration/app-configuration/review/app-configuration.api.md b/sdk/appconfiguration/app-configuration/review/app-configuration.api.md index 93a9b10be30a..578708344c15 100644 --- a/sdk/appconfiguration/app-configuration/review/app-configuration.api.md +++ b/sdk/appconfiguration/app-configuration/review/app-configuration.api.md @@ -7,6 +7,7 @@ import { HttpResponse } from '@azure/core-http'; import { OperationOptions } from '@azure/core-http'; import { PagedAsyncIterableIterator } from '@azure/core-paging'; +import { RetryOptions } from '@azure/core-http'; import { TokenCredential } from '@azure/identity'; import { UserAgentOptions } from '@azure/core-http'; @@ -37,6 +38,7 @@ export class AppConfigurationClient { // @public export interface AppConfigurationClientOptions { + retryOptions?: Pick; userAgentOptions?: UserAgentOptions; } diff --git a/sdk/appconfiguration/app-configuration/src/appConfigurationClient.ts b/sdk/appconfiguration/app-configuration/src/appConfigurationClient.ts index f29024c20614..2652766efb7a 100644 --- a/sdk/appconfiguration/app-configuration/src/appConfigurationClient.ts +++ b/sdk/appconfiguration/app-configuration/src/appConfigurationClient.ts @@ -14,7 +14,8 @@ import { ServiceClientCredentials, UserAgentOptions, getDefaultUserAgentValue as getCoreHttpDefaultUserAgentValue, - userAgentPolicy + userAgentPolicy, + RetryOptions } from "@azure/core-http"; import { throttlingRetryPolicy } from "./policies/throttlingRetryPolicy"; import { TokenCredential } from "@azure/identity"; @@ -99,6 +100,11 @@ export interface AppConfigurationClientOptions { * Options for adding user agent details to outgoing requests. */ userAgentOptions?: UserAgentOptions; + + /** + * Options that control how to retry failed requests. + */ + retryOptions?: Pick; } /** @@ -529,7 +535,7 @@ export function getGeneratedClientOptions( const retryPolicies = [ exponentialRetryPolicy(), systemErrorRetryPolicy(), - throttlingRetryPolicy() + throttlingRetryPolicy(internalAppConfigOptions.retryOptions) ]; const userAgent = getUserAgentPrefix( diff --git a/sdk/appconfiguration/app-configuration/src/policies/throttlingRetryPolicy.ts b/sdk/appconfiguration/app-configuration/src/policies/throttlingRetryPolicy.ts index 020daedd7cfb..83c2accb2b98 100644 --- a/sdk/appconfiguration/app-configuration/src/policies/throttlingRetryPolicy.ts +++ b/sdk/appconfiguration/app-configuration/src/policies/throttlingRetryPolicy.ts @@ -10,23 +10,29 @@ import { WebResource, HttpOperationResponse, Constants, - RestError + RestError, + RetryOptions } from "@azure/core-http"; import { delay } from "@azure/core-http"; /** * @internal */ -export function throttlingRetryPolicy(): RequestPolicyFactory { +export function throttlingRetryPolicy( + retryOptions?: Pick +): RequestPolicyFactory { return { create: (nextPolicy: RequestPolicy, options: RequestPolicyOptions) => { - return new ThrottlingRetryPolicy(nextPolicy, options); + return new ThrottlingRetryPolicy(nextPolicy, options, retryOptions); } }; } const StandardAbortMessage = "The operation was aborted."; +// Merge this constant with the one in core-http when we unify throttling retry policy in core-http and app-config +const DEFAULT_CLIENT_RETRY_COUNT = 3; + /** * This policy is a close copy of the ThrottlingRetryPolicy class from * core-http with modifications to work with how AppConfig is currently @@ -35,7 +41,12 @@ const StandardAbortMessage = "The operation was aborted."; * @internal */ export class ThrottlingRetryPolicy extends BaseRequestPolicy { - constructor(nextPolicy: RequestPolicy, options: RequestPolicyOptions) { + private numberOfRetries = 0; + constructor( + nextPolicy: RequestPolicy, + options: RequestPolicyOptions, + private retryOptions: Pick = {} + ) { super(nextPolicy, options); } @@ -44,10 +55,14 @@ export class ThrottlingRetryPolicy extends BaseRequestPolicy { if (isRestErrorWithHeaders(err)) { const delayInMs = getDelayInMs(err.response.headers); - if (delayInMs == null) { + if ( + delayInMs == null || + (this.retryOptions.maxRetryDelayInMs && delayInMs > this.retryOptions.maxRetryDelayInMs) + ) { throw err; } + this.numberOfRetries += 1; await delay(delayInMs, undefined, { abortSignal: httpRequest.abortSignal, abortErrorMsg: StandardAbortMessage @@ -55,7 +70,18 @@ export class ThrottlingRetryPolicy extends BaseRequestPolicy { if (httpRequest.abortSignal?.aborted) { throw new AbortError(StandardAbortMessage); } - return await this.sendRequest(httpRequest.clone()); + + if (this.retryOptions.maxRetries == undefined) { + this.retryOptions.maxRetries = DEFAULT_CLIENT_RETRY_COUNT; + } + + if (this.numberOfRetries < this.retryOptions.maxRetries) { + // retries + return this.sendRequest(httpRequest.clone()); + } else { + // passes on to the next policy + return this._nextPolicy.sendRequest(httpRequest.clone()); + } } else { throw err; } diff --git a/sdk/appconfiguration/app-configuration/test/internal/node/throttlingRetryPolicy.spec.ts b/sdk/appconfiguration/app-configuration/test/internal/node/throttlingRetryPolicy.spec.ts index aee3b8bd2fb1..c7ebc71d8fdc 100644 --- a/sdk/appconfiguration/app-configuration/test/internal/node/throttlingRetryPolicy.spec.ts +++ b/sdk/appconfiguration/app-configuration/test/internal/node/throttlingRetryPolicy.spec.ts @@ -7,16 +7,16 @@ import { AbortController } from "@azure/abort-controller"; import nock from "nock"; import { generateUuid } from "@azure/core-http"; -describe("Should not retry forever - honors the abort signal passed", () => { +describe("Should not retry forever", () => { let client: AppConfigurationClient; const connectionString = "Endpoint=https://myappconfig.azconfig.io;Id=key:ai/u/fake;Secret=abcd="; - beforeEach(function() { + function mockErrorResponse(retryAfterMs: string, persistance: boolean = true) { if (!nock.isActive()) { nock.activate(); } nock("https://myappconfig.azconfig.io:443") - .persist() + .persist(persistance) .put(/.*/g) .reply( 429, @@ -26,9 +26,11 @@ describe("Should not retry forever - honors the abort signal passed", () => { policy: "Total Requests", status: 429 }, - ["retry-after-ms", "123456"] + ["retry-after-ms", retryAfterMs] ); + } + beforeEach(() => { client = new AppConfigurationClient(connectionString); }); @@ -38,7 +40,8 @@ describe("Should not retry forever - honors the abort signal passed", () => { nock.enableNetConnect(); }); - it("simulate the service throttling", async () => { + it("simulate the service throttling - honors the abort signal passed", async () => { + mockErrorResponse("123456"); const key = generateUuid(); const numberOfSettings = 200; const promises = []; @@ -64,4 +67,40 @@ describe("Should not retry forever - honors the abort signal passed", () => { } chai.assert.equal(errorWasThrown, true, "Error was not thrown"); }); + + it("should not retry forever without abortSignal", async () => { + const responseCount = 10; + for (let index = 0; index < responseCount; index++) { + mockErrorResponse("100", false); + } + const key = generateUuid(); + let errorWasThrown = false; + + chai.assert.equal( + nock.pendingMocks().length, + responseCount, + "unexpected pending mocks before making the request" + ); + try { + await client.addConfigurationSetting({ + key: key, + value: "added" + }); + } catch (error) { + errorWasThrown = true; + chai.assert.equal(error.name, "RestError", "Unexpected error thrown"); + chai.assert.equal(JSON.parse(error.message).status, 429, "Unexpected error thrown"); + chai.assert.equal( + JSON.parse(error.message).title, + "Resource utilization has surpassed the assigned quota", + "Unexpected error thrown" + ); + } + chai.assert.equal(errorWasThrown, true, "Error was not thrown"); + chai.assert.equal( + nock.pendingMocks().length, + responseCount - 1 - 3, // one attempt + three retries + "unexpected pending mocks after the test was run" + ); + }); }); From 726bf80042b08bcf07a38038b57e9850520daa06 Mon Sep 17 00:00:00 2001 From: Harsha Nalluru Date: Wed, 14 Jul 2021 03:00:18 +0000 Subject: [PATCH 02/11] typo --- .../test/internal/node/throttlingRetryPolicy.spec.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/appconfiguration/app-configuration/test/internal/node/throttlingRetryPolicy.spec.ts b/sdk/appconfiguration/app-configuration/test/internal/node/throttlingRetryPolicy.spec.ts index c7ebc71d8fdc..364d64dacdf8 100644 --- a/sdk/appconfiguration/app-configuration/test/internal/node/throttlingRetryPolicy.spec.ts +++ b/sdk/appconfiguration/app-configuration/test/internal/node/throttlingRetryPolicy.spec.ts @@ -11,12 +11,12 @@ describe("Should not retry forever", () => { let client: AppConfigurationClient; const connectionString = "Endpoint=https://myappconfig.azconfig.io;Id=key:ai/u/fake;Secret=abcd="; - function mockErrorResponse(retryAfterMs: string, persistance: boolean = true) { + function mockErrorResponse(retryAfterMs: string, persistence: boolean = true) { if (!nock.isActive()) { nock.activate(); } nock("https://myappconfig.azconfig.io:443") - .persist(persistance) + .persist(persistence) .put(/.*/g) .reply( 429, From 4cdb12c8bdffa1a0d54a1fd3216f4e5854c1b34c Mon Sep 17 00:00:00 2001 From: Harsha Nalluru Date: Wed, 14 Jul 2021 03:17:51 +0000 Subject: [PATCH 03/11] update versions --- sdk/appconfiguration/app-configuration/package.json | 2 +- .../app-configuration/src/appConfigurationClient.ts | 2 +- .../src/generated/src/appConfigurationContext.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sdk/appconfiguration/app-configuration/package.json b/sdk/appconfiguration/app-configuration/package.json index ce9157fc93cb..80d06db6ee18 100644 --- a/sdk/appconfiguration/app-configuration/package.json +++ b/sdk/appconfiguration/app-configuration/package.json @@ -2,7 +2,7 @@ "name": "@azure/app-configuration", "author": "Microsoft Corporation", "description": "An isomorphic client library for the Azure App Configuration service.", - "version": "1.2.0", + "version": "1.2.1", "sdk-type": "client", "keywords": [ "node", diff --git a/sdk/appconfiguration/app-configuration/src/appConfigurationClient.ts b/sdk/appconfiguration/app-configuration/src/appConfigurationClient.ts index 2652766efb7a..d55335799ba9 100644 --- a/sdk/appconfiguration/app-configuration/src/appConfigurationClient.ts +++ b/sdk/appconfiguration/app-configuration/src/appConfigurationClient.ts @@ -71,7 +71,7 @@ const packageName = "azsdk-js-app-configuration"; * User - Agent header. There's a unit test that makes sure it always stays in sync. * @internal */ -export const packageVersion = "1.2.0"; +export const packageVersion = "1.2.1"; const apiVersion = "1.0"; const ConnectionStringRegex = /Endpoint=(.*);Id=(.*);Secret=(.*)/; const deserializationContentTypes = { diff --git a/sdk/appconfiguration/app-configuration/src/generated/src/appConfigurationContext.ts b/sdk/appconfiguration/app-configuration/src/generated/src/appConfigurationContext.ts index d5dba464891e..80da0fb2a364 100644 --- a/sdk/appconfiguration/app-configuration/src/generated/src/appConfigurationContext.ts +++ b/sdk/appconfiguration/app-configuration/src/generated/src/appConfigurationContext.ts @@ -10,7 +10,7 @@ import * as coreHttp from "@azure/core-http"; import { ApiVersion10, AppConfigurationOptionalParams } from "./models"; const packageName = "app-configuration"; -const packageVersion = "1.2.0"; +const packageVersion = "1.2.1"; /** @internal */ export class AppConfigurationContext extends coreHttp.ServiceClient { From 037f993a7e1b4a11806650f3323528f955418cdd Mon Sep 17 00:00:00 2001 From: Harsha Nalluru Date: Wed, 14 Jul 2021 03:18:00 +0000 Subject: [PATCH 04/11] Add changelog --- sdk/appconfiguration/app-configuration/CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sdk/appconfiguration/app-configuration/CHANGELOG.md b/sdk/appconfiguration/app-configuration/CHANGELOG.md index ff83426e89c0..95de384f3612 100644 --- a/sdk/appconfiguration/app-configuration/CHANGELOG.md +++ b/sdk/appconfiguration/app-configuration/CHANGELOG.md @@ -1,5 +1,13 @@ # Release History +## 1.2.1 (Unreleased) + +### Fixed + +- Throttling may have resulted in retrying the request indefinitely if the service responded with `retry-after-ms` header in the error always. The behaviour has been changed to retry to a maximum of 3 times by default from [#16376](https://github.com/Azure/azure-sdk-for-js/pull/16376). + - Additionally, [#16376](https://github.com/Azure/azure-sdk-for-js/pull/16376) also exposes retryOptions on the `AppConfigurationClient`'s client options, which lets you configure the `maxRetries` and the `maxRetryDelayInMs`. + - More resources - [App Configuration | Throttling](https://docs.microsoft.com/azure/azure-app-configuration/rest-api-throttling) and [App Configuration | Requests Quota](https://docs.microsoft.com/azure/azure-app-configuration/faq#which-app-configuration-tier-should-i-use) + ## 1.2.0 (2021-07-07) ### Features Added From 2db9c691918c4d6f7441ba0dd7d4f229c8683581 Mon Sep 17 00:00:00 2001 From: Harsha Nalluru Date: Wed, 14 Jul 2021 00:49:58 -0700 Subject: [PATCH 05/11] Update sdk/appconfiguration/app-configuration/CHANGELOG.md --- sdk/appconfiguration/app-configuration/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/appconfiguration/app-configuration/CHANGELOG.md b/sdk/appconfiguration/app-configuration/CHANGELOG.md index 95de384f3612..f0c221ee1a06 100644 --- a/sdk/appconfiguration/app-configuration/CHANGELOG.md +++ b/sdk/appconfiguration/app-configuration/CHANGELOG.md @@ -4,7 +4,7 @@ ### Fixed -- Throttling may have resulted in retrying the request indefinitely if the service responded with `retry-after-ms` header in the error always. The behaviour has been changed to retry to a maximum of 3 times by default from [#16376](https://github.com/Azure/azure-sdk-for-js/pull/16376). +- Throttling may have resulted in retrying the request indefinitely if the service responded with `retry-after-ms` header in the error for each new request. The behaviour has been changed to retry for a maximum of 3 times by default from [#16376](https://github.com/Azure/azure-sdk-for-js/pull/16376). - Additionally, [#16376](https://github.com/Azure/azure-sdk-for-js/pull/16376) also exposes retryOptions on the `AppConfigurationClient`'s client options, which lets you configure the `maxRetries` and the `maxRetryDelayInMs`. - More resources - [App Configuration | Throttling](https://docs.microsoft.com/azure/azure-app-configuration/rest-api-throttling) and [App Configuration | Requests Quota](https://docs.microsoft.com/azure/azure-app-configuration/faq#which-app-configuration-tier-should-i-use) From feefe53822b20d3117c6031e8d09748d86c93c5e Mon Sep 17 00:00:00 2001 From: Harsha Nalluru Date: Wed, 14 Jul 2021 10:15:08 -0700 Subject: [PATCH 06/11] Update sdk/appconfiguration/app-configuration/CHANGELOG.md --- sdk/appconfiguration/app-configuration/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/appconfiguration/app-configuration/CHANGELOG.md b/sdk/appconfiguration/app-configuration/CHANGELOG.md index f3ae60c2667d..4379512cee3b 100644 --- a/sdk/appconfiguration/app-configuration/CHANGELOG.md +++ b/sdk/appconfiguration/app-configuration/CHANGELOG.md @@ -8,7 +8,7 @@ ### Bugs Fixed -- Throttling may have resulted in retrying the request indefinitely if the service responded with `retry-after-ms` header in the error for each new request. The behaviour has been changed to retry for a maximum of 3 times by default from [#16376](https://github.com/Azure/azure-sdk-for-js/pull/16376). +- Throttling may have resulted in retrying the request indefinitely if the service responded with `retry-after-ms` header in the error for each retried request. The behaviour has been changed to retry for a maximum of 3 times by default from [#16376](https://github.com/Azure/azure-sdk-for-js/pull/16376). - Additionally, [#16376](https://github.com/Azure/azure-sdk-for-js/pull/16376) also exposes retryOptions on the `AppConfigurationClient`'s client options, which lets you configure the `maxRetries` and the `maxRetryDelayInMs`. - More resources - [App Configuration | Throttling](https://docs.microsoft.com/azure/azure-app-configuration/rest-api-throttling) and [App Configuration | Requests Quota](https://docs.microsoft.com/azure/azure-app-configuration/faq#which-app-configuration-tier-should-i-use) From 763b69629175bdac31ebd8b7b2b6d4f3df110ef3 Mon Sep 17 00:00:00 2001 From: Harsha Nalluru Date: Wed, 14 Jul 2021 20:40:14 +0000 Subject: [PATCH 07/11] Redeclare RetryOptions --- .../src/appConfigurationClient.ts | 6 +++--- .../app-configuration/src/models.ts | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/sdk/appconfiguration/app-configuration/src/appConfigurationClient.ts b/sdk/appconfiguration/app-configuration/src/appConfigurationClient.ts index d55335799ba9..3cb6c491ee97 100644 --- a/sdk/appconfiguration/app-configuration/src/appConfigurationClient.ts +++ b/sdk/appconfiguration/app-configuration/src/appConfigurationClient.ts @@ -14,8 +14,7 @@ import { ServiceClientCredentials, UserAgentOptions, getDefaultUserAgentValue as getCoreHttpDefaultUserAgentValue, - userAgentPolicy, - RetryOptions + userAgentPolicy } from "@azure/core-http"; import { throttlingRetryPolicy } from "./policies/throttlingRetryPolicy"; import { TokenCredential } from "@azure/identity"; @@ -36,6 +35,7 @@ import { ListConfigurationSettingsOptions, ListRevisionsOptions, ListRevisionsPage, + RetryOptions, SetConfigurationSettingOptions, SetConfigurationSettingParam, SetConfigurationSettingResponse, @@ -104,7 +104,7 @@ export interface AppConfigurationClientOptions { /** * Options that control how to retry failed requests. */ - retryOptions?: Pick; + retryOptions?: RetryOptions; } /** diff --git a/sdk/appconfiguration/app-configuration/src/models.ts b/sdk/appconfiguration/app-configuration/src/models.ts index 6463baae8e32..61a828e328f6 100644 --- a/sdk/appconfiguration/app-configuration/src/models.ts +++ b/sdk/appconfiguration/app-configuration/src/models.ts @@ -331,3 +331,19 @@ export interface SetReadOnlyResponse extends ConfigurationSetting, SyncTokenHeaderField, HttpResponseField {} + +/** + * Options that control how to retry failed requests. + */ +export interface RetryOptions { + /** + * The maximum number of retry attempts. Defaults to 3. + */ + maxRetries?: number; + + /** + * The maximum delay in milliseconds allowed before retrying an operation. Defaults + * to 90000 (90 seconds). + */ + maxRetryDelayInMs?: number; +} From 98be9a5dd563d17d97987c0c3c9afc29715b37e8 Mon Sep 17 00:00:00 2001 From: Harsha Nalluru Date: Wed, 14 Jul 2021 20:42:31 +0000 Subject: [PATCH 08/11] API Report --- .../app-configuration/review/app-configuration.api.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sdk/appconfiguration/app-configuration/review/app-configuration.api.md b/sdk/appconfiguration/app-configuration/review/app-configuration.api.md index 578708344c15..919ba38fb408 100644 --- a/sdk/appconfiguration/app-configuration/review/app-configuration.api.md +++ b/sdk/appconfiguration/app-configuration/review/app-configuration.api.md @@ -7,7 +7,6 @@ import { HttpResponse } from '@azure/core-http'; import { OperationOptions } from '@azure/core-http'; import { PagedAsyncIterableIterator } from '@azure/core-paging'; -import { RetryOptions } from '@azure/core-http'; import { TokenCredential } from '@azure/identity'; import { UserAgentOptions } from '@azure/core-http'; @@ -38,7 +37,7 @@ export class AppConfigurationClient { // @public export interface AppConfigurationClientOptions { - retryOptions?: Pick; + retryOptions?: RetryOptions; userAgentOptions?: UserAgentOptions; } @@ -176,6 +175,12 @@ export function parseFeatureFlag(setting: ConfigurationSetting): ConfigurationSe // @public export function parseSecretReference(setting: ConfigurationSetting): ConfigurationSetting; +// @public +export interface RetryOptions { + maxRetries?: number; + maxRetryDelayInMs?: number; +} + // @public export const secretReferenceContentType = "application/vnd.microsoft.appconfig.keyvaultref+json;charset=utf-8"; From 18c30c7095d74b6dc8e3f5ab9349870e87a2cba4 Mon Sep 17 00:00:00 2001 From: Harsha Nalluru Date: Wed, 14 Jul 2021 20:45:50 +0000 Subject: [PATCH 09/11] delay(maxRetryDelayInMs) for the case of (this.retryOptions.maxRetryDelayInMs && delayInMs > this.retryOptions.maxRetryDelayInMs) --- .../src/policies/throttlingRetryPolicy.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/sdk/appconfiguration/app-configuration/src/policies/throttlingRetryPolicy.ts b/sdk/appconfiguration/app-configuration/src/policies/throttlingRetryPolicy.ts index 83c2accb2b98..14963a86945e 100644 --- a/sdk/appconfiguration/app-configuration/src/policies/throttlingRetryPolicy.ts +++ b/sdk/appconfiguration/app-configuration/src/policies/throttlingRetryPolicy.ts @@ -53,13 +53,17 @@ export class ThrottlingRetryPolicy extends BaseRequestPolicy { public async sendRequest(httpRequest: WebResource): Promise { return this._nextPolicy.sendRequest(httpRequest.clone()).catch(async (err) => { if (isRestErrorWithHeaders(err)) { - const delayInMs = getDelayInMs(err.response.headers); + let delayInMs = getDelayInMs(err.response.headers); + + if (delayInMs == null) { + throw err; + } if ( - delayInMs == null || - (this.retryOptions.maxRetryDelayInMs && delayInMs > this.retryOptions.maxRetryDelayInMs) + this.retryOptions.maxRetryDelayInMs && + delayInMs > this.retryOptions.maxRetryDelayInMs ) { - throw err; + delayInMs = this.retryOptions.maxRetryDelayInMs; } this.numberOfRetries += 1; From 8cbb6b790b1185580a4ec68d635daeb73c371a00 Mon Sep 17 00:00:00 2001 From: Harsha Nalluru Date: Wed, 14 Jul 2021 22:38:27 +0000 Subject: [PATCH 10/11] address feedback --- .../src/policies/throttlingRetryPolicy.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/sdk/appconfiguration/app-configuration/src/policies/throttlingRetryPolicy.ts b/sdk/appconfiguration/app-configuration/src/policies/throttlingRetryPolicy.ts index 14963a86945e..2ad387652c8a 100644 --- a/sdk/appconfiguration/app-configuration/src/policies/throttlingRetryPolicy.ts +++ b/sdk/appconfiguration/app-configuration/src/policies/throttlingRetryPolicy.ts @@ -10,17 +10,15 @@ import { WebResource, HttpOperationResponse, Constants, - RestError, - RetryOptions + RestError } from "@azure/core-http"; import { delay } from "@azure/core-http"; +import { RetryOptions } from "../models"; /** * @internal */ -export function throttlingRetryPolicy( - retryOptions?: Pick -): RequestPolicyFactory { +export function throttlingRetryPolicy(retryOptions?: RetryOptions): RequestPolicyFactory { return { create: (nextPolicy: RequestPolicy, options: RequestPolicyOptions) => { return new ThrottlingRetryPolicy(nextPolicy, options, retryOptions); @@ -45,7 +43,7 @@ export class ThrottlingRetryPolicy extends BaseRequestPolicy { constructor( nextPolicy: RequestPolicy, options: RequestPolicyOptions, - private retryOptions: Pick = {} + private retryOptions: RetryOptions = { maxRetries: DEFAULT_CLIENT_RETRY_COUNT } ) { super(nextPolicy, options); } From 99bbd7f090ea276438301b20b4d77593b3277e0e Mon Sep 17 00:00:00 2001 From: Harsha Nalluru Date: Thu, 15 Jul 2021 18:01:08 +0000 Subject: [PATCH 11/11] remove 90 seconds default --- sdk/appconfiguration/app-configuration/src/models.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sdk/appconfiguration/app-configuration/src/models.ts b/sdk/appconfiguration/app-configuration/src/models.ts index 61a828e328f6..ecd8e0bab2e1 100644 --- a/sdk/appconfiguration/app-configuration/src/models.ts +++ b/sdk/appconfiguration/app-configuration/src/models.ts @@ -342,8 +342,7 @@ export interface RetryOptions { maxRetries?: number; /** - * The maximum delay in milliseconds allowed before retrying an operation. Defaults - * to 90000 (90 seconds). + * The maximum delay in milliseconds allowed before retrying an operation. */ maxRetryDelayInMs?: number; }