Azure / azure-cosmosdb-node

We recently announced deprecation of JS v1 SDK and this repo. Starting September 2020 Microsoft will not provide support for this library. Existing applications using library will continue to work as-is. We strongly recommend upgrading to @azure/cosmos library.
https://github.com/Azure/azure-sdk-for-js
MIT License
141 stars 108 forks source link

How to config retry max count for endpoint? #253

Closed CoolRice closed 5 years ago

CoolRice commented 6 years ago

When DB is down, it keeps output "Error trying to connect, refreshing the regions list from database account and will retry the request.", even if I have set maxRetryAttemptCount for RetryOptions.

const connectionPolicy = new DocumentBase.ConnectionPolicy();
connectionPolicy.RetryOptions = new RetryOptions(5);

const client = new DocumentClient(serverConfig.cosmos.endpoint, { masterKey: serverConfig.cosmos.masterKey }, connectionPolicy);

Then I looked source code. It seems that maxRetryAttemptCount is hardcoded to 120 and no way to override it. https://github.com/Azure/azure-cosmosdb-node/blob/15cf138373beb86b9678e5cb4d09ad2c2fe1fb34/source/lib/endpointDiscoveryRetryPolicy.js#L76

Can you give any help?

GustavoMoreiraPT commented 5 years ago

Hi @CoolRice ,

Do you still have this issue? When I have EnableEndpointDiscovery set to true, and then I turn off cosmos, it takes 4 to 5 minutes before timming out. I need to force this to timeout after 5 seconds or so, but I could not get any workaround.

Did you find one?

Thank you,

Gustavo

southpolesteve commented 5 years ago

We have recently announced deprecation version 1.x of the Azure Cosmos JavaScript SDK. We will end support for the documentdb package and this repo on August 30, 2020. Please update to our new package @azure/cosmos as soon as possible. If you encounter any issues, you can raise them in the Azure central JS SDK repo. If something is preventing you from upgrading to the latest version of the SDK, you can always email me directly: stfaul@microsoft.com