Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
CrossRegionHedging: Fixes CosmosNullReference Bug implementing recomm…
…endations
  • Loading branch information
dibahlfi committed Nov 6, 2024
commit c8cbc90a00fb6b9e12fe385c20d48768dca70721
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@ internal override async Task<ResponseMessage> ExecuteAvailabilityStrategyAsync(
request,
hedgeRegions.ElementAt(requestNumber),
cancellationToken,
cancellationTokenSource, trace);
cancellationTokenSource,
trace);

requestTasks.Add(primaryRequest);
}
Expand Down Expand Up @@ -262,7 +263,8 @@ private async Task<HedgingResponse> CloneAndSendAsync(
clonedRequest,
region,
cancellationToken,
cancellationTokenSource, trace);
cancellationTokenSource,
trace);
}
}

Expand All @@ -271,7 +273,8 @@ private async Task<HedgingResponse> RequestSenderAndResultCheckAsync(
RequestMessage request,
string hedgedRegion,
CancellationToken cancellationToken,
CancellationTokenSource cancellationTokenSource, ITrace trace)
CancellationTokenSource cancellationTokenSource,
ITrace trace)
{
try
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -842,7 +842,6 @@ public async Task AvailabilityStrategyStepTests(string operation, string condito

[TestMethod]
[TestCategory("MultiRegion")]
[ExpectedException(typeof(CosmosOperationCanceledException))]
public async Task AvailabilityStrategyWithCancellationTokenThrowsExceptionTest()
{
FaultInjectionRule responseDelay = new FaultInjectionRuleBuilder(
Expand Down Expand Up @@ -885,10 +884,11 @@ public async Task AvailabilityStrategyWithCancellationTokenThrowsExceptionTest()
Database database = faultInjectionClient.GetDatabase(CosmosAvailabilityStrategyTests.dbName);
Container container = database.GetContainer(CosmosAvailabilityStrategyTests.containerName);

ItemResponse<AvailabilityStrategyTestObject> ir = await container.ReadItemAsync<AvailabilityStrategyTestObject>(
"testId",
new PartitionKey("pk"), cancellationToken: cts.Token
);
CosmosOperationCanceledException cancelledException = await Assert.ThrowsExceptionAsync<CosmosOperationCanceledException>(() =>
container.ReadItemAsync<AvailabilityStrategyTestObject>(
"testId",
new PartitionKey("pk"), cancellationToken: cts.Token
));

}

Expand Down