From 6bcffb0ebb783c5b4b94b5add975878fff9825b3 Mon Sep 17 00:00:00 2001 From: damocles Date: Wed, 21 Oct 2026 21:22:39 +0200 Subject: [PATCH] todo socket: pause after a failed accept instead of spinning --- hive-agent/src/todo_server.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/hive-agent/src/todo_server.rs b/hive-agent/src/todo_server.rs index 5e56f8a4..6d755dad 100644 --- a/hive-agent/src/todo_server.rs +++ b/hive-agent/src/todo_server.rs @@ -43,6 +43,10 @@ use crate::todos::{Todo, Todos}; /// dashboard's `ctx·Nk` badge before hitting the `/compact` button. 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 /// unset/empty (e.g. a standalone dev run) — the server then stays off. fn socket_path() -> Option { @@ -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; + } } } }