hive-c0re: bound the forge readiness probe
wait_until_ready only checked READY_TIMEOUT between polls, so a half-open forge hung the first get_version forever. The probe now goes through forge::bounded; a timeout counts as not-ready and falls into the existing retry/deadline path.
This commit is contained in:
parent
2b0154be28
commit
1726ad3bad
1 changed files with 6 additions and 3 deletions
|
|
@ -197,8 +197,8 @@ pub(crate) fn api(token: &str) -> Result<Forgejo> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Upper bound on one Forgejo API request. `forgejo-api` takes no
|
/// Upper bound on one Forgejo API request. `forgejo-api` takes no
|
||||||
/// caller-built client, so the request itself has no timeout; every call
|
/// caller-built client, so the request itself has no timeout; every request
|
||||||
/// through [`api`] is wrapped in [`bounded`].
|
/// in this module is wrapped in [`bounded`].
|
||||||
const API_TIMEOUT: Duration = Duration::from_secs(10);
|
const API_TIMEOUT: Duration = Duration::from_secs(10);
|
||||||
|
|
||||||
/// Await one Forgejo API request for at most [`API_TIMEOUT`].
|
/// Await one Forgejo API request for at most [`API_TIMEOUT`].
|
||||||
|
|
@ -359,7 +359,10 @@ async fn wait_until_ready() -> bool {
|
||||||
let deadline = Instant::now() + READY_TIMEOUT;
|
let deadline = Instant::now() + READY_TIMEOUT;
|
||||||
let mut waited = false;
|
let mut waited = false;
|
||||||
loop {
|
loop {
|
||||||
if client.get_version().await.is_ok() {
|
if bounded("forge readiness probe", client.get_version())
|
||||||
|
.await
|
||||||
|
.is_ok_and(|probe| probe.is_ok())
|
||||||
|
{
|
||||||
if waited {
|
if waited {
|
||||||
tracing::info!("forge: endpoint ready, proceeding with provisioning");
|
tracing::info!("forge: endpoint ready, proceeding with provisioning");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue