private Task StartSubscriptionLoop(List <Endpoint> previousEndpoints) { return(Task.Run(async() => { while (!_cts.IsCancellationRequested) { try { var currentEndpoints = await _serviceSubscriber.Endpoints(_cts.Token).ConfigureAwait(false); if (!EndpointListsMatch(previousEndpoints, currentEndpoints)) { _cache.Set(_id, currentEndpoints); EndpointsChanged?.Invoke(this, EventArgs.Empty); previousEndpoints = currentEndpoints; } } catch { // ignore } } }, _cts.Token)); }
private void ReloadDevices() { _reloadDevicesBusy.Yield(() => EndpointsChanged?.Invoke(this, EventArgs.Empty)); }
/// <summary> /// Raises the <see cref="EndpointsChanged"/> event. /// </summary> void OnEndpointsChanged() { EndpointsChanged?.Invoke(this, EventArgs.Empty); }