Skip to content

Commit

Permalink
fix possible locking issue in PollingWildCardChangeToken, fixes #103997
Browse files Browse the repository at this point in the history
… (#104969)
  • Loading branch information
adamsitnik authored Jul 17, 2024
1 parent 1058460 commit acfb801
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,20 @@ public bool HasChanged
return _changed;
}

if (Clock.UtcNow - _lastScanTimeUtc >= PollingInterval)
if (ShouldRefresh())
{
lock (_enumerationLock)
{
_changed = CalculateChanges();
if (!_changed && ShouldRefresh())
{
_changed = CalculateChanges();
}
}
}

return _changed;

bool ShouldRefresh() => Clock.UtcNow - _lastScanTimeUtc >= PollingInterval;
}
}

Expand Down

0 comments on commit acfb801

Please sign in to comment.