Skip to content

Commit

Permalink
Moving to ValueFactory overloads of ConcurrentDictionary (#2852)
Browse files Browse the repository at this point in the history
  • Loading branch information
kirankumarkolli authored Nov 10, 2021
1 parent 5001696 commit 8646349
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Microsoft.Azure.Cosmos/src/Routing/GatewayAddressCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,8 @@ internal Tuple<PartitionKeyRangeIdentity, PartitionAddressInformation> ToPartiti
addressInfo.PhysicalUri);

HashSet<PartitionKeyRangeIdentity> pkRangeIdSet = this.serverPartitionAddressToPkRangeIdMap.GetOrAdd(
new ServerKey(new Uri(addressInfo.PhysicalUri)), new HashSet<PartitionKeyRangeIdentity>());
new ServerKey(new Uri(addressInfo.PhysicalUri)),
(_) => new HashSet<PartitionKeyRangeIdentity>());
lock (pkRangeIdSet)
{
pkRangeIdSet.Add(partitionKeyRangeIdentity);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public override bool TryMarkEndpointUnavailableForPartitionKeyRange(

PartitionKeyRangeFailoverInfo partionFailover = this.PartitionKeyRangeToLocation.Value.GetOrAdd(
partitionKeyRange,
new PartitionKeyRangeFailoverInfo(failedLocation));
(_) => new PartitionKeyRangeFailoverInfo(failedLocation));

// Will return true if it was able to update to a new region
if (partionFailover.TryMoveNextLocation(
Expand Down

0 comments on commit 8646349

Please sign in to comment.