优化 agent 信息上报与 ARM 安装面板的错误提示

This commit is contained in:
naiba
2021-06-30 18:15:53 +08:00
parent 92ecb33901
commit 8d0e269b73
9 changed files with 23 additions and 15 deletions

View File

@@ -267,12 +267,14 @@ func doTask(task *pb.Task) {
func reportState() {
var lastReportHostInfo time.Time
var err error
var now time.Time
defer println("reportState exit", time.Now(), "=>", err)
for {
now = time.Now()
if client != nil {
monitor.TrackNetworkSpeed()
timeOutCtx, cancel := context.WithTimeout(context.Background(), networkTimeOut)
_, err = client.ReportSystemState(timeOutCtx, monitor.GetState(dao.ReportDelay).PB())
_, err = client.ReportSystemState(timeOutCtx, monitor.GetState().PB())
cancel()
if err != nil {
println("reportState error", err)
@@ -283,6 +285,7 @@ func reportState() {
client.ReportSystemInfo(context.Background(), monitor.GetHost().PB())
}
}
time.Sleep(time.Until(now.Add(time.Second)))
}
}