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
|
|
@ -227,7 +227,13 @@ pub fn spawn(client: Arc<Client>) -> Arc<ConfigPrCache> {
|
|||
let mut ticker = tokio::time::interval(POLL_INTERVAL);
|
||||
loop {
|
||||
ticker.tick().await;
|
||||
match client.list_open_config_prs().await {
|
||||
let Some(scan) =
|
||||
crate::forge::within_pass_deadline("config-pr poll", client.list_open_config_prs())
|
||||
.await
|
||||
else {
|
||||
continue;
|
||||
};
|
||||
match scan {
|
||||
Ok(scan) => cache_for_task.replace(scan),
|
||||
Err(e) => {
|
||||
tracing::warn!(
|
||||
|
|
|
|||
Loading…
Reference in a new issue