summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoriximeow <me@iximeow.net>2023-07-04 09:30:52 -0700
committeriximeow <me@iximeow.net>2023-07-04 09:30:52 -0700
commit721f96591b037729f1a0d9ff2bb8831b81b79925 (patch)
tree3084bf5f253291c7582d5ca3797a25878fc7b6c2
parentaa5bf75922dfecac53656ba76aadc180593b3d15 (diff)
that query was just wildly wrong
i dunno how the `and not exists` is going to work out over time, probably need some kinda checkpointing so that i don't have to rule out the entire build history for a host every time it asks for a new task
-rw-r--r--src/sql.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/sql.rs b/src/sql.rs
index 137cdb6..cbd5c2a 100644
--- a/src/sql.rs
+++ b/src/sql.rs
@@ -142,7 +142,10 @@ pub const PENDING_RUNS: &'static str = "\
select id, job_id, created_time, host_preference from runs where state=0 and (host_preference=?1 or host_preference is null) order by created_time desc;";
pub const JOBS_NEEDING_HOST_RUN: &'static str = "\
- select jobs.id, jobs.source, jobs.created_time, jobs.remote_id, jobs.commit_id, jobs.run_preferences from jobs left join runs on jobs.id=runs.job_id where jobs.run_preferences=\"all\" and (host_id!=?1 or host_id is null);";
+ select jobs.id, jobs.source, jobs.created_time, jobs.remote_id, jobs.commit_id, jobs.run_preferences from jobs\
+ where jobs.run_prefererences=\"all\"
+ and not exists\
+ (select 1 from runs r2 where r2.job_id = jobs.id and r2.host_id = ?1);";
pub const ACTIVE_RUNS: &'static str = "\
select id,