From 1fe3acc1422b09db27d179db05331a763b1db8a6 Mon Sep 17 00:00:00 2001 From: iximeow Date: Mon, 26 Dec 2022 00:21:32 +0000 Subject: let build runners indicate restricted interest --- src/dbctx.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/dbctx.rs') diff --git a/src/dbctx.rs b/src/dbctx.rs index d025b8d..c4eb767 100644 --- a/src/dbctx.rs +++ b/src/dbctx.rs @@ -25,6 +25,7 @@ pub struct PendingJob { pub remote_id: u64, pub commit_id: u64, pub created_time: u64, + pub source: Option, } #[derive(Debug, Clone, Copy, PartialEq, Eq)] @@ -219,7 +220,7 @@ impl DbCtx { Ok(conn.last_insert_rowid() as u64) } - pub fn new_job(&self, remote_id: u64, sha: &str) -> Result { + pub fn new_job(&self, remote_id: u64, sha: &str, pusher: Option<&str>) -> Result { // TODO: potential race: if two remotes learn about a commit at the same time and we decide // to create two jobs at the same time, this might return an incorrect id if the insert // didn't actually insert a new row. @@ -233,8 +234,8 @@ impl DbCtx { let conn = self.conn.lock().unwrap(); let rows_modified = conn.execute( - "insert into jobs (state, remote_id, commit_id, created_time) values (?1, ?2, ?3, ?4);", - (crate::sql::JobState::Pending as u64, remote_id, commit_id, created_time) + "insert into jobs (state, remote_id, commit_id, created_time, source) values (?1, ?2, ?3, ?4, ?5);", + (crate::sql::JobState::Pending as u64, remote_id, commit_id, created_time, pusher) ).unwrap(); assert_eq!(1, rows_modified); @@ -250,12 +251,13 @@ impl DbCtx { let mut pending = Vec::new(); while let Some(row) = jobs.next().unwrap() { - let (id, artifacts, state, run_host, remote_id, commit_id, created_time) = row.try_into().unwrap(); + let (id, artifacts, state, run_host, remote_id, commit_id, created_time, source) = row.try_into().unwrap(); let state: u8 = state; pending.push(PendingJob { id, artifacts, state: state.try_into().unwrap(), - run_host, remote_id, commit_id, created_time + run_host, remote_id, commit_id, created_time, + source, }); } -- cgit v1.1