Comments (6)
We have an internal exponential retry mechanism for certain amount of time and then bail out if things still fail.
from azure-sdk-for-js.
@RodgeFu, @nickzhums, @qiaozha Can we close this issue with a pointer to show how to configure the retry policy?
from azure-sdk-for-js.
@RodgeFu @zikalino do we have any track 1 retry policy samples?
from azure-sdk-for-js.
Hi @itilitymaarten ,
You can find exponentialRetryPolicy, systemErrorRetryPolicy and throttlingRetryPolicy here: https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/core/core-http/src/policies
They can be used as any other policies in JS SDK, a sample for policy assignment can be found here:
from azure-sdk-for-js.
@changlong-liu That sample is for @azure/core-http
where as the management libraries use @azure/ms-rest-js
. Though the former is built on top of the latter, it might have had changes done to it. Have you tried that sample with @azure/arm-commerce
package?
from azure-sdk-for-js.
Thank you @ramya-rao-a .
I have just had a try on @azure/arm-commerce, and found it's not using core-http, but the old @azure/ms-rest-js 1.x.x. And also an old version for ms-rest-nodeauth.
Correct the policy folder for ms-rest-js as: https://github.com/Azure/ms-rest-js/tree/1.x/lib/policies
Reference code for creating policy factory: https://github.com/Azure/ms-rest-js/blob/master/lib/serviceClient.ts#L401
Below are some details in my verification for @azure/[email protected]:
npm install "@azure/[email protected]"
npm install "@azure/ms-rest-nodeauth": "^2.0.4"
code:
import { UsageManagementClient, UsageManagementModels } from "@azure/arm-commerce"
import { exponentialRetryPolicy, signingPolicy, generateClientRequestIdPolicy, deserializationPolicy, redirectPolicy} from "@azure/ms-rest-js"
import { loginWithServicePrincipalSecret, ApplicationTokenCredentials } from "@azure/ms-rest-nodeauth";
function main() {
loginWithServicePrincipalSecret(
"[YOUR CLIENT ID]",
"[YOUR SECRET]",
"[YOUR TENANT]",
(err: any, credentials: ApplicationTokenCredentials) => {
if (err) throw err;
const clientOptions: UsageManagementModels.UsageManagementClientOptions = {
requestPolicyFactories: [
generateClientRequestIdPolicy(),
signingPolicy(credentials),
redirectPolicy(),
exponentialRetryPolicy(10, 10),
deserializationPolicy()
]
};
const client = new UsageManagementClient(credentials, subscriptionId, clientOptions);
const reportedStartTime = new Date("2019-3-1 0:00:00Z").toISOString();
const reportedEndTime = new Date("2019-4-1 0:00:00Z").toISOString();
client.usageAggregates.list(reportedStartTime, reportedEndTime).then((result) => {
console.log("The result is:");
console.log(result);
});
}
);
}
main();
from azure-sdk-for-js.
Related Issues (20)
- [engsys] npm 22.5.0 breaking release pipeline
- [engSys] Remove AZURE_POD_IDENTITY_AUTHORITY_HOST workaround HOT 3
- Get backup vault name associated with VM HOT 9
- Device provision service in React Native. HOT 8
- [identity] Samples are failing but pipeline continues to pass
- [DataLake] Module not found: Can't resolve '../../storage-blob/src/utils/cache' HOT 3
- [Bulk/Batch API] Add support for suppressing the API response
- [Communication - Phone Numbers] can set an existing trunk failing in nightly
- [Event Hubs] AmqpAnnotatedMessage > round-tripping AMQP encoding/decoding > data (useBatch: true) failing in nightly runs HOT 4
- Buffer from Service-Bus adds special characters if you convert it to a string HOT 7
- Error message shown after finishing a transfer to a phone number HOT 2
- [storage] move back to use ^ version for @azure/identity
- [EngSys] remove the workaround to suppress azure powershell warning
- [arm-botservice] fix sanitizer and re-record test HOT 2
- BackgroundBlurEffect requires Content Security Policy 'unsafe-eval' HOT 2
- [cosmos] React Native support HOT 2
- arm-subscriptions: Subscription list and get methods do not return tags of the subscription HOT 4
- List Key Vault Certificates HOT 3
- IMDS probe requests should throw CredentialUnavailableException for any response that is not valid json
- [Search Documents] "before each" hook for "count returns the correct document count" failing in nightly runs HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from azure-sdk-for-js.