fix: 避免 agent 与 dashboard 更新不同步情况

This commit is contained in:
naiba
2024-07-28 15:44:06 +08:00
parent 80ef923a38
commit c50a21c5b1
2 changed files with 3 additions and 8 deletions
+1 -2
View File
@@ -427,10 +427,9 @@ func reportState() {
if lastReportHostInfo.Before(time.Now().Add(-10 * time.Minute)) {
lastReportHostInfo = time.Now()
client.ReportSystemInfo(context.Background(), monitor.GetHost().PB())
if monitor.GeoQueryIPChanged {
if monitor.GeoQueryIP != "" {
geoip, err := client.LookupGeoIP(context.Background(), &pb.GeoIP{Ip: monitor.GeoQueryIP})
if err == nil {
monitor.GeoQueryIPChanged = false
monitor.CachedCountryCode = geoip.GetCountryCode()
}
}