summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoriximeow <me@iximeow.net>2023-07-02 01:03:38 -0700
committeriximeow <me@iximeow.net>2023-07-02 01:03:38 -0700
commitac6e821638fe8254682a6e84761a20e460b25adf (patch)
treeb7a65c4963e2d3869674f89d7f6531ec77eb597d
parent5da80c7631f07913f5d5568046089c91a0deb7d2 (diff)
cleanup, logging
-rw-r--r--src/ci_driver.rs33
1 files changed, 17 insertions, 16 deletions
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<DbCtx>) {
let mut potentially_stale_tasks = dbctx.get_active_runs().unwrap();
@@ -553,22 +569,7 @@ async fn old_task_reaper(dbctx: Arc<DbCtx>) {
}).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;
- }
-}