This commit is contained in:
2023-01-19 02:00:26 +00:00
parent a5993f4570
commit 9800d5a672
2 changed files with 6 additions and 7 deletions

View File

@@ -261,10 +261,8 @@ namespace Sockeye.Biz
if (!KeepOnWorking()) return;
//SOCKBOT - SUBSCRIPTION SERVER HEALTH CHECKS
await SockBotSubscriptionServerHealthChecks.DoWorkAsync();
if (!KeepOnWorking()) return;
//JOB SWEEPER
await CoreJobSweeper.DoWorkAsync();

View File

@@ -12,14 +12,14 @@ namespace Sockeye.Biz
/// <summary>
/// Check the health of subscribers servers, basically a ping check
/// trigger notification if any fail the test excessively (some slack for intermittent comm. issues)
/// Check the health of subscribers servers using the /health endpoint
/// trigger notification if any fail the test 3 times (some slack for intermittent comm. issues)
/// </summary>
internal static class SockBotSubscriptionServerHealthChecks
{
private static ILogger log = Sockeye.Util.ApplicationLogging.CreateLogger("SockBotSubscriptionServerHealthChecks");
private static DateTime lastSweep = DateTime.MinValue;
private static TimeSpan HEALTHCHECK_EVERY_INTERVAL = new TimeSpan(0, 15, 10);//every 15 minutes roughly
private static TimeSpan HEALTHCHECK_EVERY_INTERVAL = new TimeSpan(0, 5, 10);//every 5 minutes roughly meaning 15 minutes down is highest fail state
////////////////////////////////////////////////////////////////////////////////////////////////
// DoSweep
//
@@ -71,6 +71,7 @@ namespace Sockeye.Biz
var responseText = await res.Content.ReadAsStringAsync();
srv.LastHealthCheck = DateTime.UtcNow;
srv.LastHealthStatus = responseText;
log.LogDebug($"Health check server {srv.Name} response {responseText}");
if (res.IsSuccessStatusCode && responseText == "Healthy")
{
//a-ok