Skip to content

Commit 6c2f9d5

Browse files
fix vanish detection API call
1 parent ed0e54a commit 6c2f9d5

1 file changed

Lines changed: 2 additions & 9 deletions

File tree

PoolManager.cs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -286,12 +286,7 @@ private async Task CheckForStuckJobs(List<GithubTargetConfiguration> targetConfi
286286
}
287287

288288
// check job on github
289-
GitHubJob ghJob = owner.Target switch
290-
{
291-
TargetType.Repository => await GitHubApi.GetJobInfoForRepo(stuckJob.GithubJobId, owner.Name, owner.GitHubToken),
292-
TargetType.Organization => await GitHubApi.GetJobInfoForOrg(stuckJob.GithubJobId, owner.Name, owner.GitHubToken),
293-
_ => throw new ArgumentOutOfRangeException()
294-
};
289+
GitHubJob ghJob = await GitHubApi.GetJobInfoForRepo(stuckJob.GithubJobId, stuckJob.Repository , owner.GitHubToken);
295290
if (ghJob == null || ghJob.Status != "queued")
296291
{
297292
_logger.LogWarning($"job info for {stuckJob.JobId} not found or job not queued anymore on github.");
@@ -304,12 +299,10 @@ private async Task CheckForStuckJobs(List<GithubTargetConfiguration> targetConfi
304299
{
305300
_logger.LogWarning($"GHjob status for {stuckJob.JobId} is {ghJob.Status}");
306301
}
307-
308-
309302

310303
if (stuckJob.QueueTime + TimeSpan.FromHours(2) > DateTime.UtcNow)
311304
{
312-
_logger.LogWarning($"Would mark stuck job {stuckJob.GithubJobId} vanished as it's no longer in the GitHub queued state for more than 2h.");
305+
_logger.LogWarning($"Marking stuck job {stuckJob.GithubJobId} vanished as it's no longer in the GitHub queued state for more than 2h.");
313306
stuckJob.State = JobState.Vanished;
314307
stuckJob.CompleteTime = DateTime.UtcNow;
315308
await db.SaveChangesAsync();

0 commit comments

Comments
 (0)