chore: 记录HTTP Keep-Alive 连接复用不支持的问题

This commit is contained in:
meiseayoung
2025-12-26 15:52:24 +08:00
parent 3355e274e2
commit 7c1aa656ab
5 changed files with 64 additions and 4 deletions
+4
View File
@@ -2,6 +2,7 @@ module hono
import net.urllib
import net.http
import time
// Context 路由器
struct ContextRouter {
@@ -265,6 +266,9 @@ fn (mut s ServerHanler) exec_context_middlewares(idx int, mut ctx Context, handl
pub fn (mut app Hono) listen(port string) {
app.server.addr = port
app.server.handler = server_hanler_new(app)
// 增加超时配置以支持更好的 Keep-Alive
app.server.read_timeout = 60 * time.second
app.server.write_timeout = 60 * time.second
app.server.listen_and_serve()
}