diff options
author | iximeow <me@iximeow.net> | 2023-07-04 10:33:30 -0700 |
---|---|---|
committer | iximeow <me@iximeow.net> | 2023-07-04 10:33:30 -0700 |
commit | 0f97747c2e3e6f3178e414adc5b6022ead275601 (patch) | |
tree | 0dbc4850685f61e4b002672483dd4a08395b9155 /src | |
parent | 6935d9f34f6475e6f294fce0bb6fd684440e4696 (diff) |
cap max wait time for new tasks
Diffstat (limited to 'src')
-rw-r--r-- | src/ci_driver.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/ci_driver.rs b/src/ci_driver.rs index 5855352..f6c1828 100644 --- a/src/ci_driver.rs +++ b/src/ci_driver.rs @@ -533,6 +533,8 @@ async fn main() { } async fn find_client_task(dbctx: Arc<DbCtx>, mut candidate: RunnerClient) -> Result<(), String> { + let find_client_task_start = std::time::Instant::now(); + let (run, job) = 'find_work: loop { // try to find a job for this candidate: // * start with pending runs - these need *some* client to run them, but do not care which @@ -568,6 +570,10 @@ async fn find_client_task(dbctx: Arc<DbCtx>, mut candidate: RunnerClient) -> Res if candidate.test_connection().await.is_err() { return Err("lost client connection".to_string()); } + + if find_client_task_start.elapsed().as_secs() > 300 { + return Err("5min new task deadline elapsed".to_string()); + } }; eprintln!("enqueueing job {} for alternate run under host id {}", job.id, candidate.host_id); |