Ejemplo n.º 1
0
 public ServiceStatus GetServiceHealthStatus()
 {
     lock (ServiceStatusLock)
     {
         var now = _timeProvider.GetUtcNow();
         if (now - _healthStatusRefresh > HealthStatusTimeOut)
         {
             _cachedServiceStatus = Retry(() =>
             {
                 var statusTask = _healthClient.GetAsync();
                 Task.WaitAll(statusTask);
                 return(statusTask.Result);
             });
             _healthStatusRefresh = now;
         }
         return(_cachedServiceStatus);
     }
 }