Skip to content

Commit

Permalink
stabelize culling
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticroentgen committed Apr 23, 2024
1 parent 61b2fdf commit e4ae706
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions CloudController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -210,12 +210,12 @@ public async Task DeleteRunner(long serverId)

if (srvMeta == null)
{
_logger.LogError($"VM with ID {serverId} not in list. Aborting.");
_logger.LogWarning($"VM with ID {serverId} not in active runners list. Only removing from htz.");
await _client.Server.Delete(serverId);
return;
}

_logger.LogInformation($"Deleting VM {srvMeta.Name} with IP {srvMeta.Ipv4}");
var srv = await _client.Server.Get(serverId);
await _client.Server.Delete(serverId);

// Do some stats
Expand Down
2 changes: 1 addition & 1 deletion PoolManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ private async Task CullRunners(List<OrgConfiguration> orgConfig, List<Server> al
foreach (var r in idlePoolRunner)
{
var htzSrv = allHtzSrvs.FirstOrDefault(x => x.Name == r.name);
if (DateTime.Now - htzSrv.Created < TimeSpan.FromMinutes(15))
if (htzSrv != null && DateTime.Now - htzSrv.Created < TimeSpan.FromMinutes(15))
{
// Don't cull a recently created runner. there might be a job waiting for pickup
continue;
Expand Down

0 comments on commit e4ae706

Please sign in to comment.