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) <noreply@anthropic.com>
This commit is contained in:
@@ -29,7 +29,10 @@ function readVersion(): string {
|
|||||||
const ANONYMOUS_PATHS = new Set(["/v1/list", "/v1/peek"]);
|
const ANONYMOUS_PATHS = new Set(["/v1/list", "/v1/peek"]);
|
||||||
|
|
||||||
export async function buildServer(cfg: DaemonConfig, store: MailboxStore): Promise<FastifyInstance> {
|
export async function buildServer(cfg: DaemonConfig, store: MailboxStore): Promise<FastifyInstance> {
|
||||||
const app = Fastify({ logger: true });
|
const app = Fastify({
|
||||||
|
logger: true,
|
||||||
|
connectionTimeout: 310_000,
|
||||||
|
});
|
||||||
const version = readVersion();
|
const version = readVersion();
|
||||||
|
|
||||||
app.addHook("onRequest", async (req: FastifyRequest, reply: FastifyReply) => {
|
app.addHook("onRequest", async (req: FastifyRequest, reply: FastifyReply) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user