This commit is contained in:
@@ -70,12 +70,25 @@ namespace Sockeye.Biz
|
||||
//http status code = 503 for UnHealthy
|
||||
//for our purposes anything other than 200 and "Healthy" is a problem
|
||||
|
||||
var res = await client.GetAsync($"https://{srv.Name}/health");
|
||||
var responseText = await res.Content.ReadAsStringAsync();
|
||||
HttpResponseMessage res = null;
|
||||
string responseText = string.Empty;
|
||||
bool Failed = false;
|
||||
try
|
||||
{
|
||||
res = await client.GetAsync($"https://{srv.Name}/health");
|
||||
responseText = await res.Content.ReadAsStringAsync();
|
||||
if (res.IsSuccessStatusCode && responseText == "Healthy")
|
||||
Failed = false;
|
||||
}
|
||||
catch (System.Net.Http.HttpRequestException hex)
|
||||
{
|
||||
Failed = true;
|
||||
responseText = $"Failure {hex.Message}";
|
||||
}
|
||||
srv.LastHealthCheck = DateTime.UtcNow;
|
||||
srv.LastHealthStatus = responseText;
|
||||
log.LogDebug($"Health check server {srv.Name} response {responseText}");
|
||||
if (res.IsSuccessStatusCode && responseText == "Healthy")
|
||||
if (!Failed)
|
||||
{
|
||||
//a-ok
|
||||
srv.ServerState = ServerState.ActiveHealthy;
|
||||
|
||||
Reference in New Issue
Block a user