From c311a570dafec89c0dcd124bdfabd67e69833adf Mon Sep 17 00:00:00 2001 From: Your Name Date: Sun, 26 Apr 2026 02:45:50 +0800 Subject: [PATCH] =?UTF-8?q?Fix:=20=E6=B7=BB=E5=8A=A0=E5=91=BD=E4=BB=A4?= =?UTF-8?q?=E9=97=B4500=E6=AF=AB=E7=A7=92=E5=BB=B6=E8=BF=9F=E9=98=B2?= =?UTF-8?q?=E6=AD=A2H3C=E8=AE=BE=E5=A4=87=E9=80=9F=E7=8E=87=E9=99=90?= =?UTF-8?q?=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 每个SSH命令执行后等待500毫秒 - 解决命令交替返回0字节的问题 --- internal/device/parser.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/internal/device/parser.go b/internal/device/parser.go index 30226a4..a462980 100644 --- a/internal/device/parser.go +++ b/internal/device/parser.go @@ -77,9 +77,14 @@ func DiscoverDevice(ip string, deviceType models.DeviceType, username, password // 获取命令列表 commands := parser.GetCommands() - // 执行命令 - 允许部分命令失败,增加详细日志 + // 执行命令 - 允许部分命令失败,增加详细日志和延迟防止设备速率限制 outputs := make([]string, 0, len(commands)) for i, cmd := range commands { + // 每个命令之间等待500毫秒,防止设备速率限制导致返回空数据 + if i > 0 { + time.Sleep(500 * time.Millisecond) + } + fmt.Printf("[PARSER] Executing command %d/%d: %s\n", i+1, len(commands), cmd) output, err := client.ExecuteCommand(cmd) if err != nil {