Fix: 添加命令间500毫秒延迟防止H3C设备速率限制

- 每个SSH命令执行后等待500毫秒
- 解决命令交替返回0字节的问题
This commit is contained in:
Your Name
2026-04-26 02:45:50 +08:00
parent a9fcb47ef5
commit c311a570da
+6 -1
View File
@@ -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 {