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:
parent
dd172d9cf8
commit
45f0582163
7 changed files with 85 additions and 9 deletions
|
|
@ -1082,7 +1082,12 @@ pub fn spawn(client: Arc<Client>) {
|
|||
let mut ticker = tokio::time::interval(RECONCILE_INTERVAL);
|
||||
loop {
|
||||
ticker.tick().await;
|
||||
let outcome = client.reconcile(&desired).await;
|
||||
let Some(outcome) =
|
||||
super::within_pass_deadline("swarm forge objects", client.reconcile(&desired))
|
||||
.await
|
||||
else {
|
||||
continue;
|
||||
};
|
||||
if outcome.failed > 0 {
|
||||
tracing::warn!(
|
||||
applied = outcome.applied,
|
||||
|
|
|
|||
Loading…
Reference in a new issue