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
1 changed files with 85 additions and 9 deletions
|
|
@ -77,7 +77,15 @@ pub fn spawn(client: Arc<Client>) {
|
|||
let mut last_written: Option<String> = None;
|
||||
loop {
|
||||
ticker.tick().await;
|
||||
match pass(&client, last_written.as_deref()).await {
|
||||
let Some(outcome) = super::within_pass_deadline(
|
||||
"runner registration token",
|
||||
pass(&client, last_written.as_deref()),
|
||||
)
|
||||
.await
|
||||
else {
|
||||
continue;
|
||||
};
|
||||
match outcome {
|
||||
Ok(Some(written)) => {
|
||||
tracing::info!("runner registration token: written to the store");
|
||||
last_written = Some(written);
|
||||
|
|
|
|||
Loading…
Reference in a new issue