-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[App Config] Handle throttling - do not hang - should honor abort signal #15721
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
Merged
Merged
Changes from 7 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
5955709
Add abort-controller in dependencies
HarshaNalluru 16a5238
src
HarshaNalluru f6270b7
Update ThrottlingRetryPolicy.sendRequest
HarshaNalluru ee6c764
test for throttling policy
HarshaNalluru bea4617
delayBetweenRechecksInMs
HarshaNalluru 613407c
throttling retry policy updates
HarshaNalluru 6579a13
test
HarshaNalluru 93a2913
address Richard's feedback
HarshaNalluru fe63f7b
delete the live test
HarshaNalluru 1ca2bb6
Should not retry forever - honors the abort signal passed test
HarshaNalluru b294f36
Merge branch 'master' of https://github.com/Azure/azure-sdk-for-js in…
HarshaNalluru d5cfcfe
Merge branch 'master' of https://github.com/Azure/azure-sdk-for-js in…
HarshaNalluru 596f4cc
changelog
HarshaNalluru 9becefe
changelog update
HarshaNalluru dc204db
delay method with abort signal
HarshaNalluru 4547c23
no need of generics
HarshaNalluru 5aac533
local en-us remove from links
HarshaNalluru 77b0d3d
check for AbortError
HarshaNalluru File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
sdk/appconfiguration/app-configuration/test/public/throttling.spec.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT license. | ||
|
|
||
| import { createAppConfigurationClientForTests, startRecorder } from "./utils/testHelpers"; | ||
| import { AppConfigurationClient } from "../../src"; | ||
| import { Recorder } from "@azure/test-utils-recorder"; | ||
| import { Context } from "mocha"; | ||
| import { AbortController } from "@azure/abort-controller"; | ||
|
|
||
| describe("AppConfigurationClient", () => { | ||
| let client: AppConfigurationClient; | ||
| let recorder: Recorder; | ||
|
|
||
| beforeEach(function(this: Context) { | ||
| recorder = startRecorder(this); | ||
| client = createAppConfigurationClientForTests() || this.skip(); | ||
| }); | ||
|
|
||
| afterEach(async function(this: Context) { | ||
| await recorder.stop(); | ||
| }); | ||
|
|
||
| describe.only("simple usages", () => { | ||
HarshaNalluru marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| it("Add and query a setting without a label", async () => { | ||
| const key = recorder.getUniqueName("noLabelTests"); | ||
| const numberOfSettings = 200; | ||
| const times = 1000; | ||
| for (let time = 0; time < times; time++) { | ||
| const promises = []; | ||
| try { | ||
| for (let index = 0; index < numberOfSettings; index++) { | ||
| promises.push( | ||
| client.addConfigurationSetting( | ||
| { | ||
| key: key + " " + +index, | ||
| value: "added" | ||
| }, | ||
| { | ||
| abortSignal: AbortController.timeout(10000) | ||
| } | ||
| ) | ||
| ); | ||
| } | ||
| await Promise.all(promises); | ||
| } catch (error) { | ||
| console.log(error); | ||
| } | ||
| } | ||
|
|
||
| await cleanupSampleValues([key], client); | ||
| }); | ||
| }); | ||
| }); | ||
|
|
||
| async function cleanupSampleValues(keys: string[], client: AppConfigurationClient) { | ||
| const settingsIterator = client.listConfigurationSettings({ | ||
| keyFilter: keys.join(",") | ||
| }); | ||
|
|
||
| for await (const setting of settingsIterator) { | ||
| await client.deleteConfigurationSetting({ key: setting.key, label: setting.label }); | ||
| } | ||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.