in reference-implementations/semantic-search-for-images/src/ui-backend/Controllers/HealthController.cs [27:47]
public async Task<IActionResult> ReadinessProbe()
{
_logger.LogTrace("Checking readiness probe.");
bool isReady;
try
{
isReady = await _databaseService.IsReady();
}
catch (Exception e)
{
_logger.LogDebug("Exception thrown when checking database service readiness: [{message}] {stacktrace}", e.Message, e.StackTrace);
return BadRequest("Service not ready.");
}
if (isReady)
return Ok();
else
{
_logger.LogDebug("No exceptions thrown, but database service reported it was not ready.");
return BadRequest("Service not ready.");
}
}