Skip to content

Commit

Permalink
fix htz offline detection
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticroentgen committed May 7, 2024
1 parent 1b1c57a commit 81b7b53
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions PoolManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -207,6 +211,10 @@ private async Task CleanUpRunners(List<GithubTargetConfiguration> 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
Expand Down

0 comments on commit 81b7b53

Please sign in to comment.