Skip to content

Commit

Permalink
Add additional condition before requesting update.
Browse files Browse the repository at this point in the history
  • Loading branch information
Brent Schmaltz committed Jan 16, 2025
1 parent 9e91a64 commit 95779ab
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -248,22 +248,26 @@ public virtual async Task<T> GetConfigurationAsync(CancellationToken cancel)
{
if (_refreshRequested)
{
_refreshRequested = false;
// Log as manual because RequestRefresh was called
TelemetryClient.IncrementConfigurationRefreshRequestCounter(
MetadataAddress,
TelemetryConstants.Protocols.Manual);

UpdateCurrentConfiguration();
_refreshRequested = false;
}
else
else if (SyncAfter <= _timeProvider.GetUtcNow())
{
TelemetryClient.IncrementConfigurationRefreshRequestCounter(
MetadataAddress,
TelemetryConstants.Protocols.Automatic);
MetadataAddress,
TelemetryConstants.Protocols.Automatic);

_ = Task.Run(UpdateCurrentConfiguration, CancellationToken.None);
}
else
{
Interlocked.Exchange(ref _configurationRetrieverState, ConfigurationRetrieverIdle);
}
}
}

Expand Down

0 comments on commit 95779ab

Please sign in to comment.