From bc53daf6e6bb3a81cb0d05f2ec349b383b7a2a8f Mon Sep 17 00:00:00 2001 From: Mika Kuns Date: Wed, 20 May 2026 16:24:26 +0200 Subject: [PATCH] fix(server): set explicit connectionTimeout to bound long-poll sockets Fastify's default connectionTimeout is 0 (no timeout). With /v1/watch holding requests open for up to 300s, an OS-level cap prevents a stuck socket from persisting forever even if app-level cleanup misses a case. Set just above the watch max so a healthy long-poll never races the socket timeout. Co-Authored-By: Claude Opus 4.7 (1M context) --- node/src/server.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/node/src/server.ts b/node/src/server.ts index c63c2e3..c0996bc 100644 --- a/node/src/server.ts +++ b/node/src/server.ts @@ -29,7 +29,10 @@ function readVersion(): string { const ANONYMOUS_PATHS = new Set(["/v1/list", "/v1/peek"]); export async function buildServer(cfg: DaemonConfig, store: MailboxStore): Promise { - const app = Fastify({ logger: true }); + const app = Fastify({ + logger: true, + connectionTimeout: 310_000, + }); const version = readVersion(); app.addHook("onRequest", async (req: FastifyRequest, reply: FastifyReply) => {