Skip to content

Commit c1113d1

Browse files
authored
fix: introduce dedicated lock object (#552)
1 parent fd19aa3 commit c1113d1

File tree

1 file changed

+3
-1
lines changed
  • Modules/Quotas/src/Quotas.Domain/Aggregates/Identities

1 file changed

+3
-1
lines changed

Modules/Quotas/src/Quotas.Domain/Aggregates/Identities/Identity.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ public class Identity
1313
private readonly List<IndividualQuota> _individualQuotas;
1414
private readonly List<MetricStatus> _metricStatuses;
1515

16+
private readonly object _latestExhaustionDateLock = new();
17+
1618
// ReSharper disable once UnusedMember.Local
1719
private Identity()
1820
{
@@ -120,7 +122,7 @@ await Parallel.ForEachAsync(quotasForMetric, cancellationToken, async (quota, _)
120122

121123
var quotaExhaustion = quota.CalculateExhaustion(newUsage);
122124

123-
lock (latestExhaustionDate)
125+
lock (_latestExhaustionDateLock)
124126
{
125127
if (quotaExhaustion > latestExhaustionDate)
126128
latestExhaustionDate = quotaExhaustion;

0 commit comments

Comments
 (0)