From ac6e821638fe8254682a6e84761a20e460b25adf Mon Sep 17 00:00:00 2001 From: iximeow Date: Sun, 2 Jul 2023 01:03:38 -0700 Subject: cleanup, logging --- src/ci_driver.rs | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/ci_driver.rs b/src/ci_driver.rs index d41cb75..fca1e6e 100644 --- a/src/ci_driver.rs +++ b/src/ci_driver.rs @@ -511,6 +511,22 @@ async fn main() { spawn(axum_server::bind_rustls(driver_config.server_addr.parse().unwrap(), config) .serve(api_server.into_make_service())); + spawn(old_task_reaper(Arc::clone(&dbctx))); + + loop { + let runs = dbctx.get_pending_runs().unwrap(); + + if runs.len() > 0 { + println!("{} new runs", runs.len()); + + for run in runs.into_iter() { + activate_run(Arc::clone(&dbctx), &run, &mut channel).await; + } + } + tokio::time::sleep(std::time::Duration::from_millis(100)).await; + } +} + async fn old_task_reaper(dbctx: Arc) { let mut potentially_stale_tasks = dbctx.get_active_runs().unwrap(); @@ -553,22 +569,7 @@ async fn old_task_reaper(dbctx: Arc) { }).collect(); for task in stale_tasks.iter() { + eprintln!("looks like task {} is stale, reaping", task.id); dbctx.reap_task(task.id).expect("works"); } } - - spawn(old_task_reaper(Arc::clone(&dbctx))); - - loop { - let runs = dbctx.get_pending_runs().unwrap(); - - if runs.len() > 0 { - println!("{} new runs", runs.len()); - - for run in runs.into_iter() { - activate_run(Arc::clone(&dbctx), &run, &mut channel).await; - } - } - tokio::time::sleep(std::time::Duration::from_millis(100)).await; - } -} -- cgit v1.1