public static async Task <BusHealthStatus> WaitForHealthStatus(this IBusHealth healthChecks, BusHealthStatus expectedStatus, CancellationToken cancellationToken) { var result = healthChecks.CheckHealth(); while (result.Status != expectedStatus) { cancellationToken.ThrowIfCancellationRequested(); await Task.Delay(100, cancellationToken).ConfigureAwait(false); result = healthChecks.CheckHealth(); } return(result.Status); }
public AmqpService( IBus bus, IBusHealth busHealth, IServiceScopeFactory scopeFactory, ILogger <AmqpService> logger, IHostApplicationLifetime appLifetime, IConfiguration configuration, IServiceSettings serviceSettings) { _bus = bus; _busHealth = busHealth; _scopeFactory = scopeFactory; _logger = logger; _appLifetime = appLifetime; _configuration = configuration; _serviceSettings = serviceSettings; }
public static async Task <BusHealthStatus> WaitForHealthStatus(this IBusHealth healthChecks, BusHealthStatus expectedStatus, TimeSpan timeout) { var expiresAt = DateTime.UtcNow + timeout; var result = healthChecks.CheckHealth(); while (result.Status != expectedStatus) { if (DateTime.UtcNow >= expiresAt) { return(result.Status); } await Task.Delay(100).ConfigureAwait(false); result = healthChecks.CheckHealth(); } return(result.Status); }
public BusHealthCheck(IBusHealth healthCheck) { _busHealth = healthCheck; }