Watch
0
0
Fork
You've already forked hyperhive
0

todo socket: pause after a failed accept instead of spinning

This commit is contained in:
damocles 2026-10-21 21:22:39 +02:00 • committed by mara
commit 6bcffb0ebb

View file

@ -43,6 +43,10 @@ use crate::todos::{Todo, Todos};
/// dashboard's `ctx·Nk` badge before hitting the `/compact` button. /// dashboard's `ctx·Nk` badge before hitting the `/compact` button.
const COMPACT_MIN_USAGE_FRACTION: f64 = 0.66; const COMPACT_MIN_USAGE_FRACTION: f64 = 0.66;
/// Pause after a failed `accept`, so a failure that persists (fd exhaustion)
/// does not turn the accept loop into a busy spin.
const ACCEPT_RETRY_DELAY: std::time::Duration = std::time::Duration::from_secs(1);
/// Resolve the in-agent socket path from `HIVE_AGENT_SOCKET`. `None` when /// Resolve the in-agent socket path from `HIVE_AGENT_SOCKET`. `None` when
/// unset/empty (e.g. a standalone dev run) — the server then stays off. /// unset/empty (e.g. a standalone dev run) — the server then stays off.
fn socket_path() -> Option<PathBuf> { fn socket_path() -> Option<PathBuf> {
@ -107,7 +111,12 @@ pub async fn run(
} }
}); });
} }
Err(e) => tracing::warn!(error = ?e, "in-agent todo accept failed"), Err(e) => {
tracing::warn!(error = ?e, "in-agent todo accept failed");
// A persistent failure (fd exhaustion) fails again at once;
// without a pause this loop spins and floods the log.
tokio::time::sleep(ACCEPT_RETRY_DELAY).await;
}
} }
} }
} }