-
Notifications
You must be signed in to change notification settings - Fork 494
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
Transient HTTP exceptions: Adds retry logic to all http requests #1788
Conversation
…logic for transient exceptions.
…/Azure/azure-cosmos-dotnet-v3 into users/jawilley/bug/transientHttp
As you have recently added HttpClientFactory (https://devblogs.microsoft.com/cosmosdb/httpclientfactory-cosmos-db-net-sdk/), why don't you use Polly which is now added as an extension to the framework (https://docs.microsoft.com/en-us/dotnet/architecture/microservices/implement-resilient-applications/use-httpclientfactory-to-implement-resilient-http-requests) ? It will allow us to take full advantages of MessageHandlers registration from the HttpClientFactory and have full option control over Polly directly (retry policy, circuit breaker,...). |
|
I didn't have the compatibility with .Net Standard in mind neither the need to avoid dependencies as much as possible (even with Microsoft.* packages) |
…/Azure/azure-cosmos-dotnet-v3 into users/jawilley/bug/transientHttp
Microsoft.Azure.Cosmos/src/HttpClient/TransientHttpClientRetryPolicy.cs
Outdated
Show resolved
Hide resolved
@@ -748,18 +713,6 @@ internal virtual async Task<PartitionKeyRangeCache> GetPartitionKeyRangeCacheAsy | |||
|
|||
internal GlobalAddressResolver AddressResolver { get; private set; } | |||
|
|||
internal event EventHandler<SendingRequestEventArgs> SendingRequest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will it impact compute?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, they only pass in the sending request. I didn't find any references to the properties in Cassandra or Mongo projects. It's also really dangerous because if they set a custom httpclient then this field no longer works because it's not possible to add a http client handler after that the http client is created.
Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/CosmosGatewayTimeoutTests.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Closing due to in-activity, pease feel free to re-open. |
Pull Request Template
Description
This PR adds an abstraction on top of HttpClient called CosmosHttpClient. All the caches and gateway calls have been refactored to use the new abstraction. This adds retry logic for transient exceptions that should be retried on.
Type of change
Please delete options that are not relevant.
Closing issues
closes #1769