File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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 ) ;
You can’t perform that action at this time.
0 commit comments