You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// If the cache is invalid or needs invalidation, refresh the cache.
92
-
if(_refreshTask.IsCompleted&&(_cacheState==CacheStatus.Invalid||_cachedEndpointsisnull or {ChangeToken.HasChanged:true}||force))
97
+
if(!_disposalCancellation.IsCancellationRequested&&_refreshTask.IsCompleted&&(_cacheState==CacheStatus.Invalid||_cachedEndpointsisnull or {ChangeToken.HasChanged:true}||force))
93
98
{
94
99
// Indicate that the cache is being updated and start a new refresh task.
// Check if we need to poll for updates or if we can register for change notification callbacks.
144
157
if(endpoints.ChangeToken.ActiveChangeCallbacks)
145
158
{
146
-
// Initiate a background refresh, if necessary.
147
-
endpoints.ChangeToken.RegisterChangeCallback(static state =>_=((ServiceEndpointWatcher)state!).RefreshAsync(force:false),this);
148
-
if(_pollingTimeris{}timer)
149
-
{
150
-
_pollingTimer=null;
151
-
timer.Dispose();
152
-
}
159
+
// Initiate a background refresh when the change token fires.
160
+
_changeTokenRegistration=endpoints.ChangeToken.RegisterChangeCallback(static state =>_=((ServiceEndpointWatcher)state!).RefreshAsync(force:false),this);
161
+
162
+
// Dispose the existing timer, if any, since we are reliant on change tokens for updates.
Copy file name to clipboardexpand all lines: tests/Microsoft.Extensions.ServiceDiscovery.Dns.Tests/Microsoft.Extensions.ServiceDiscovery.Dns.Tests.csproj
0 commit comments