Watch
0
0
Fork
You've already forked hyperhive
0

swarm-controller: bound each periodic forge pass with a deadline

forgejo-api 0.11.1 builds its reqwest client with no timeout and offers
no way to hand it a caller-built one (the `client` field is private,
`new`/`with_user_agent` are the only constructors, `Endpoint` is
sealed). A forge that accepts a connection and then stalls therefore
held each of the six periodic reconcile loops on one request forever,
with no log line.

Wrap each loop's per-tick work in `forge::within_pass_deadline`
(`PASS_DEADLINE`, 2 min, under the 5-minute interval): on elapsed the
pass is dropped, a warn is logged, and the loop waits for its next tick.
Every pass is an idempotent reconcile, so abandoning one mid-way leaves
nothing the next pass does not redo.

Loops: config-pr poll, runner registration token, hive forge tokens,
agent forge tokens (observe + legacy sweep), docs grants, swarm forge
objects.

Refs #5060
This commit is contained in:
atlas 2026-10-09 14:49:50 +02:00 • committed by mara
commit 45f0582163
7 changed files with 85 additions and 9 deletions

View file

@ -185,7 +185,13 @@ pub fn spawn(client: Arc<Client>, enqueue: impl Fn(Vec<String>) + Send + 'static
let mut ticker = tokio::time::interval(RECONCILE_INTERVAL);
loop {
ticker.tick().await;
let agents = run_pass(&client, read_roster().await).await;
let Some(agents) = super::within_pass_deadline("docs grants", async {
run_pass(&client, read_roster().await).await
})
.await
else {
continue;
};
if !agents.is_empty() {
enqueue(agents);
}