Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion deploy-queue/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion deploy-queue/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "deploy-queue"
version = "0.8.2"
version = "0.8.3"
edition = "2024"

[dependencies]
Expand Down
2 changes: 2 additions & 0 deletions deploy-queue/src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
23 changes: 19 additions & 4 deletions deploy-queue/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use anyhow::{Context, Result};
use anyhow::{Context, Result, bail};
use clap::Parser;

pub mod cli;
Expand Down Expand Up @@ -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
Expand Down
Loading