From ee37e35eb2ea88e7a111ce487d4d3213884c020f Mon Sep 17 00:00:00 2001 From: UUBulb <35923940+uubulb@users.noreply.github.com> Date: Sat, 23 Nov 2024 22:00:14 +0800 Subject: [PATCH] avoid fetching ip continuously (#89) --- cmd/agent/main.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/cmd/agent/main.go b/cmd/agent/main.go index 55e4cd7..e322ef3 100644 --- a/cmd/agent/main.go +++ b/cmd/agent/main.go @@ -492,9 +492,8 @@ func reportState(statClient pb.NezhaService_ReportSystemStateClient, host, ip ti } // 更新IP信息 if time.Since(ip) > time.Second*time.Duration(agentConfig.IPReportPeriod) { - if reportGeoIP(agentConfig.UseIPv6CountryCode) { - ip = time.Now() - } + reportGeoIP(agentConfig.UseIPv6CountryCode) + ip = time.Now() } return host, ip, nil }