GatewayAddressCache: Fixes Unobserved Exception During Background Address Refresh (#4039)
* Code changes to fix unobserved exception during background address refresh. * Code changes to add exception handler in task. * Code changes to fix null ref exception. * Revert "Code changes to fix null ref exception." This reverts commit83f90d578b
. * Revert "Code changes to add exception handler in task." This reverts commitc49ed81627
. * Code changes to address review comments. * Revert "Code changes to address review comments." This reverts commitd2b9f6b501
.
This commit is contained in:
Родитель
946dd4a95f
Коммит
48af69ecab
|
@ -302,14 +302,27 @@ namespace Microsoft.Azure.Cosmos.Routing
|
|||
.ReplicaTransportAddressUris
|
||||
.Any(x => x.ShouldRefreshHealthStatus()))
|
||||
{
|
||||
Task refreshAddressesInBackgroundTask = Task.Run(async () => await this.serverPartitionAddressCache.RefreshAsync(
|
||||
Task refreshAddressesInBackgroundTask = Task.Run(async () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
await this.serverPartitionAddressCache.RefreshAsync(
|
||||
key: partitionKeyRangeIdentity,
|
||||
singleValueInitFunc: (currentCachedValue) => this.GetAddressesForRangeIdAsync(
|
||||
request,
|
||||
cachedAddresses: currentCachedValue,
|
||||
partitionKeyRangeIdentity.CollectionRid,
|
||||
partitionKeyRangeIdentity.PartitionKeyRangeId,
|
||||
forceRefresh: true)));
|
||||
forceRefresh: true));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
DefaultTrace.TraceWarning("Failed to refresh addresses in the background for the collection rid: {0} with exception: {1}. '{2}'",
|
||||
partitionKeyRangeIdentity.CollectionRid,
|
||||
ex,
|
||||
System.Diagnostics.Trace.CorrelationManager.ActivityId);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return addresses;
|
||||
|
|
Загрузка…
Ссылка в новой задаче