diff options
Diffstat (limited to 'src/db/builds')
| -rw-r--r-- | src/db/builds/mod.rs | 10 | ||||
| -rw-r--r-- | src/db/builds/steps.rs | 9 |
2 files changed, 9 insertions, 10 deletions
diff --git a/src/db/builds/mod.rs b/src/db/builds/mod.rs index 2035cfd..fc84335 100644 --- a/src/db/builds/mod.rs +++ b/src/db/builds/mod.rs @@ -127,6 +127,14 @@ pub fn queued(db: &Db, limit: i64) -> Result<Vec<String>> { }) } +/// Lease one named build to a worker. +/// +/// Test-tier only. Production leases a *batch* — `claim_batch` is what the +/// dispatcher runs — and nothing in the crate calls this single-build form. +/// It stays because three test files lease one build at a time on purpose, +/// and a test that wants to reason about one lease should not have to +/// arrange for the batch form to hand back exactly one. +#[cfg(feature = "test-support")] pub fn claim(db: &Db, owner: &str, id: &str, lease_secs: i64) -> Result<bool> { let (owner, id) = (owner.to_string(), id.to_string()); let exp = time::secs_ahead(lease_secs); @@ -291,5 +299,5 @@ pub use steps::{ begin_step, blocked_builds, cancel_superseded, claim_batch, finish_step, in_flight, queue_depth, requeue_transient, retry, set_blocked_on, set_release_in, set_world, - step_status, steps, touch, + step_status, steps, }; diff --git a/src/db/builds/steps.rs b/src/db/builds/steps.rs index 01d7c40..4ffff36 100644 --- a/src/db/builds/steps.rs +++ b/src/db/builds/steps.rs @@ -149,15 +149,6 @@ pub fn blocked_builds(db: &Db) -> Result<Vec<(String, String, Vec<String>)>> { Ok(out) }) } - -pub fn touch(db: &Db, id: &str) -> Result<()> { - let id = id.to_string(); - db.writer.tx(move |tx| { - tx.execute("UPDATE build SET updated_at=?1 WHERE id=?2", params![time::now(), id])?; - Ok(()) - }) -} - pub fn set_release_in(tx: &rusqlite::Transaction<'_>, id: &str, release_id: i64) -> Result<()> { tx.execute("UPDATE build SET release_id=?1 WHERE id=?2", params![release_id, id])?; Ok(()) |
