From 9c1e1d3cc68572aae9f3856afdae369e224649d8 Mon Sep 17 00:00:00 2001 From: ursa gorse Date: Tue, 3 Feb 2026 09:43:20 +0100 Subject: [PATCH 1/2] feat(deploy-queue): Loop fetching heartbeat deployment id --- deploy-queue/src/constants.rs | 2 ++ deploy-queue/src/lib.rs | 23 +++++++++++++++++++---- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/deploy-queue/src/constants.rs b/deploy-queue/src/constants.rs index f082dd5..d8cd257 100644 --- a/deploy-queue/src/constants.rs +++ b/deploy-queue/src/constants.rs @@ -7,3 +7,5 @@ pub const BUSY_RETRY: Duration = Duration::from_secs(5); pub const HEARTBEAT_INTERVAL: Duration = Duration::from_secs(30); pub const HEARTBEAT_TIMEOUT: Duration = Duration::from_secs(15 * 60); // 15 minutes pub const HEARTBEAT_UPDATE_TIMEOUT: Duration = Duration::from_secs(20); +pub const DEPLOYMENT_ID_LOOKUP_RETRY: Duration = Duration::from_secs(10); +pub const DEPLOYMENT_ID_LOOKUP_TIMEOUT: Duration = Duration::from_secs(5 * 60); diff --git a/deploy-queue/src/lib.rs b/deploy-queue/src/lib.rs index 4ddfd05..b88e5dd 100644 --- a/deploy-queue/src/lib.rs +++ b/deploy-queue/src/lib.rs @@ -1,4 +1,4 @@ -use anyhow::{Context, Result}; +use anyhow::{Context, Result, bail}; use clap::Parser; pub mod cli; @@ -109,9 +109,24 @@ pub async fn run_deploy_queue(mode: cli::Mode, skip_migrations: bool) -> Result< })?; } cli::HeartbeatTarget::Url { url } => { - let deployment_id = handler::fetch::deployment_id_by_url(&db_client, &url) - .await? - .with_context(|| format!("No deployment found with URL: {}", url))?; + let start = std::time::Instant::now(); + let deployment_id = loop { + if let Some(deployment_id) = + handler::fetch::deployment_id_by_url(&db_client, &url).await? + { + break deployment_id; + } + + if start.elapsed() >= constants::DEPLOYMENT_ID_LOOKUP_TIMEOUT { + bail!( + "No deployment found with URL after {}s: {}", + constants::DEPLOYMENT_ID_LOOKUP_TIMEOUT.as_secs(), + url + ); + } + + tokio::time::sleep(constants::DEPLOYMENT_ID_LOOKUP_RETRY).await; + }; handler::run_heartbeat_loop(&db_client, deployment_id) .await From c93832efcbc934280dbe4928da8b39e6112a3be5 Mon Sep 17 00:00:00 2001 From: ursa gorse Date: Tue, 3 Feb 2026 09:46:00 +0100 Subject: [PATCH 2/2] chore(deploy-queue): Bump deploy queue version --- deploy-queue/Cargo.lock | 2 +- deploy-queue/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/deploy-queue/Cargo.lock b/deploy-queue/Cargo.lock index 69bcf48..316d862 100644 --- a/deploy-queue/Cargo.lock +++ b/deploy-queue/Cargo.lock @@ -342,7 +342,7 @@ dependencies = [ [[package]] name = "deploy-queue" -version = "0.8.2" +version = "0.8.3" dependencies = [ "anyhow", "backon", diff --git a/deploy-queue/Cargo.toml b/deploy-queue/Cargo.toml index 9eb54a6..1d967f9 100644 --- a/deploy-queue/Cargo.toml +++ b/deploy-queue/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "deploy-queue" -version = "0.8.2" +version = "0.8.3" edition = "2024" [dependencies]