Skip to content

Commit

Permalink
another cleanup fix
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticroentgen committed Aug 6, 2024
1 parent 2767b82 commit 572fda0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion PoolManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,7 @@ private async Task CleanUpRunners(List<GithubTargetConfiguration> targetConfigs)
// If we know the server in github, skip
continue;
}
_logger.LogInformation($"{htzSrv.Name} is a candidate to be killed from Hetzner");

var runner = await db.Runners.Include(x => x.Lifecycle).FirstOrDefaultAsync(x => x.CloudServerId == htzSrv.Id);
if (runner.Lifecycle.Any(x => x.Status == RunnerStatus.DeletionQueued))
Expand All @@ -444,7 +445,7 @@ private async Task CleanUpRunners(List<GithubTargetConfiguration> targetConfigs)

}
else if ((runner.LastState >= RunnerStatus.Provisioned && DateTime.UtcNow - runner.LastStateTime > TimeSpan.FromMinutes(5)) ||
(DateTime.UtcNow - runner.LastStateTime > TimeSpan.FromMinutes(30)))
(DateTime.UtcNow - htzSrv.Created > TimeSpan.FromMinutes(40)))
{
_logger.LogInformation($"Removing VM that is not in any GitHub registration: {htzSrv.Name} created at {htzSrv.Created:u}");
runner.IsOnline = false;
Expand Down

0 comments on commit 572fda0

Please sign in to comment.