Skip to content

Commit 6b1fa03

Browse files
[Internal] HttpTimeoutPolicy: Removes Data Plane Writes from being able to be retried (#3607)
* data plane writes no longer failover on timeout * removed duplication of test\
1 parent a34bac7 commit 6b1fa03

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

Microsoft.Azure.Cosmos/src/HttpClient/HttpTimeoutPolicy.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ public static HttpTimeoutPolicy GetTimeoutPolicy(
3636
return HttpTimeoutPolicyControlPlaneRetriableHotPath.Instance;
3737
}
3838

39-
//Data Plane Read & Write
40-
if (!HttpTimeoutPolicy.IsMetaData(documentServiceRequest))
39+
//Data Plane Read
40+
if (!HttpTimeoutPolicy.IsMetaData(documentServiceRequest) && documentServiceRequest.IsReadOnlyRequest)
4141
{
4242
return HttpTimeoutPolicyDefault.InstanceShouldThrow503OnTimeout;
4343
}

Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/CosmosHttpClientCoreTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ async Task<HttpResponseMessage> sendFunc(HttpRequestMessage request, Cancellatio
258258

259259
Assert.AreEqual(3, count, "Should retry 3 times");
260260
}
261-
261+
262262
[TestMethod]
263263
public async Task HttpTimeoutThrow503TestAsync()
264264
{
@@ -307,8 +307,8 @@ async Task<HttpResponseMessage> sendFunc(HttpRequestMessage request, Cancellatio
307307
//Data plane read
308308
await TestScenarioAsync(HttpMethod.Get, ResourceType.Document, HttpTimeoutPolicyDefault.InstanceShouldThrow503OnTimeout, typeof(CosmosException), 3);
309309

310-
//Data plane write
311-
await TestScenarioAsync(HttpMethod.Post, ResourceType.Document, HttpTimeoutPolicyDefault.InstanceShouldThrow503OnTimeout, typeof(CosmosException), 1);
310+
//Data plane write (Should throw a 408 OperationCanceledException rather than a 503)
311+
await TestScenarioAsync(HttpMethod.Post, ResourceType.Document, HttpTimeoutPolicyDefault.Instance, typeof(TaskCanceledException), 1);
312312

313313
//Meta data read
314314
await TestScenarioAsync(HttpMethod.Get, ResourceType.Database, HttpTimeoutPolicyDefault.InstanceShouldThrow503OnTimeout, typeof(CosmosException), 3);

0 commit comments

Comments
 (0)