From 81b7b538aa6df27b900756b86159fff8ade8c95d Mon Sep 17 00:00:00 2001 From: Markus Keil Date: Tue, 7 May 2024 19:09:27 +0200 Subject: [PATCH] fix htz offline detection --- PoolManager.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/PoolManager.cs b/PoolManager.cs index f5e7d67..ca466e8 100644 --- a/PoolManager.cs +++ b/PoolManager.cs @@ -52,6 +52,8 @@ protected override async Task ExecuteAsync(CancellationToken stoppingToken) try { + // update the world state for htz + allHtzSrvs = await _cc.GetAllServers(); foreach (GithubTargetConfiguration tgt in targetConfig) { GithubRunnersGauge.Labels(tgt.Name, "active").Set(0); @@ -95,6 +97,8 @@ protected override async Task ExecuteAsync(CancellationToken stoppingToken) if (DateTime.UtcNow - crudeTimer > TimeSpan.FromMinutes(cullMinutes)) { _logger.LogInformation("Cleaning runners..."); + // update the world state for htz + allHtzSrvs = await _cc.GetAllServers(); await CleanUpRunners(targetConfig, allHtzSrvs); await StartPoolRunners(targetConfig); crudeTimer = DateTime.UtcNow; @@ -207,6 +211,10 @@ private async Task CleanUpRunners(List targetConfigs, // VM younger than 30min - not cleaning yet continue; } + if (htzSrv == null) + { + continue; + } _logger.LogInformation($"Removing offline runner {runnerToRemove.Name} from org {githubTarget.Name}"); bool _ = githubTarget.Target switch