Skip to content

Commit 08ee6b4

Browse files
add >24h support
1 parent 5b57ac9 commit 08ee6b4

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

PoolManager.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -571,6 +571,22 @@ private async Task CleanUpRunners(List<GithubTargetConfiguration> targetConfigs)
571571
continue;
572572
}
573573

574+
// Check for a runner existing longer than 24h that might have vanished from github but is still processing
575+
var cspRunnerDb = await db.Runners.Include(x => x.Job).FirstOrDefaultAsync(x => x.Hostname == cspServer.Name);
576+
if (cspRunnerDb != null)
577+
{
578+
// query github for job
579+
var runnerToken = Program.Config.TargetConfigs.FirstOrDefault(x => x.Name == cspRunnerDb.Job.Owner).GitHubToken;
580+
var githubJob = await GitHubApi.GetJobInfoForOrg(cspRunnerDb.Job.GithubJobId, cspRunnerDb.Job.Repository, runnerToken);
581+
if (githubJob.Status == "running")
582+
{
583+
_logger.LogWarning($"Got a runner ({cspServer.Name}) not in GitHub anymore but still processing. Indicates a >24h job.");
584+
continue;
585+
}
586+
587+
}
588+
589+
574590
_logger.LogInformation($"{cspServer.Name} is a candidate to be killed from {cc.CloudIdentifier}");
575591

576592
var runner = await db.Runners.Include(x => x.Lifecycle).FirstOrDefaultAsync(x => x.Hostname == cspServer.Name);

0 commit comments

Comments
 (0)