From afdefccfdde0335bb93a3d95cdbfea375db9b649 Mon Sep 17 00:00:00 2001 From: ZacharyZcR Date: Tue, 2 Sep 2025 07:11:46 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BC=98=E5=8C=96Web=E8=B6=85=E6=97=B6?= =?UTF-8?q?=E8=AD=A6=E5=91=8A=E9=80=BB=E8=BE=91=EF=BC=8C=E6=B6=88=E9=99=A4?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E9=85=8D=E7=BD=AE=E7=9A=84=E8=AF=AF=E6=8A=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 问题: - 每次启动都显示 "Web超时时间大于普通超时时间,可能导致不期望的行为" - 原因:默认配置Web超时(5s) > 普通超时(3s)触发警告 - 但Web超时适当大于普通超时是合理的设计 分析: - 普通超时:用于TCP连接和简单协议探测 - Web超时:用于HTTP请求+响应+内容分析,步骤更复杂 - Web操作理应需要更多时间 修复方案: - 原逻辑:webTimeout > timeout 就警告 - 新逻辑:webTimeout > timeout*2 才警告 - 允许合理的Web超时时间设置 效果验证: - 3s vs 5s (默认):不警告 ✓ - 3s vs 7s (手动设置):仍警告 ✓ - 消除了默认配置的误报警告 --- common/parsers/networkparser.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/common/parsers/networkparser.go b/common/parsers/networkparser.go index a630244..f9d955c 100644 --- a/common/parsers/networkparser.go +++ b/common/parsers/networkparser.go @@ -206,8 +206,9 @@ func (np *NetworkParser) parseTimeouts(timeout, webTimeout int64) (time.Duration finalWebTimeout = time.Duration(webTimeout) * time.Second } - // 验证超时配置合理性 - if finalWebTimeout > finalTimeout { + // 验证超时配置合理性:只有在Web超时显著大于普通超时时才警告 + // Web超时适当大于普通超时是合理的,因为Web请求包含更多步骤 + if finalWebTimeout > finalTimeout*2 { warnings = append(warnings, i18n.GetText("config_web_timeout_warning")) }