Example #1
0
        private async Task WatchLoop()
        {
            while (_source.CanRequestRoute())
            {
                try
                {
                    var result = await _source.TryGetHealthChecksAsync();

                    if (!result.success)
                    {
                        await Task.Delay(TimeSpan.FromSeconds(1));

                        continue;
                    }

                    await ProcessHealthChecksAsync(result.checks);
                }
                catch (Exception ex)
                {
                    _logger?.LogError(1000, ex, "There was an error getting available services from consul");
                    await Task.Delay(TimeSpan.FromSeconds(1));
                }
            }
        }