From 6988be0806483e1c0f60f643b84fb68914c5c528 Mon Sep 17 00:00:00 2001 From: shaw Date: Fri, 18 Jul 2025 14:04:51 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E9=95=BF=E4=B8=8A?= =?UTF-8?q?=E4=B8=8B=E6=96=87=E8=AF=B7=E6=B1=82=E8=B6=85=E6=97=B6=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 设置HTTP服务器超时时间与代理超时时间一致 - 默认超时时间为5分钟(可通过DEFAULT_PROXY_TIMEOUT环境变量配置) - 同时设置keepAliveTimeout避免连接过早断开 - 解决了Node.js默认2分钟超时导致的长上下文处理中断问题 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- src/app.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/app.js b/src/app.js index 00b69c1b..80234412 100644 --- a/src/app.js +++ b/src/app.js @@ -270,6 +270,13 @@ class Application { logger.info(`📊 Metrics: http://${config.server.host}:${config.server.port}/metrics`); }); + // 设置服务器超时时间,与代理超时时间一致 + const serverTimeout = config.proxy.timeout || 300000; // 默认5分钟 + this.server.timeout = serverTimeout; + this.server.keepAliveTimeout = serverTimeout + 5000; // keepAlive 稍长一点 + logger.info(`⏱️ Server timeout set to ${serverTimeout}ms (${serverTimeout/1000}s)`); + + // 🔄 定期清理任务 this.startCleanupTasks();