protected override async Task Handle(RunHealthCheckCommand request, CancellationToken cancellationToken) { var user = await _db.Value.Users.SingleAsync(u => u.Ref == request.UserRef, cancellationToken); var healthCheck = user.CreateHealthCheck(); await healthCheck.Run(() => _roatpService.Ping(), () => _providerRelationshipsApiClient.Ping(cancellationToken)); _db.Value.HealthChecks.Add(healthCheck); }
public async Task <HealthCheckResult> CheckHealthAsync(HealthCheckContext context, CancellationToken cancellationToken = default) { try { await _providerRelationshipsApiClient.Ping(cancellationToken); return(HealthCheckResult.Healthy()); } catch (Exception exception) { return(HealthCheckResult.Degraded(exception.Message)); } }
public async Task Run() { await _providerRelationshipsApiClient.Ping(); Console.WriteLine("Ping succeeded"); }