private async Task Requeue(CiJob job, int retries, BaseServer server, bool serverIsExternal) { if (retries < 1) { Logger.LogError("CI build ran out of tries to try starting on the server"); job.State = CIJobState.Finished; job.FinishedAt = DateTime.UtcNow; job.Succeeded = false; await job.CreateFailureSection(Database, "Connection to build server failed after multiple retries", "Server Failure"); // Stop hogging the server and mark the build as failed await OnJobEnded(server, job); return; } JobClient.Schedule <RunJobOnServerJob>(x => x.Execute(job.CiProjectId, job.CiBuildId, job.CiJobId, server.Id, serverIsExternal, retries, CancellationToken.None), TimeSpan.FromSeconds(10)); }