mirror of
https://github.com/Buriburizaem0n/nezha_domains.git
synced 2026-11-05 09:00:20 +00:00
✨ feat: ip change notification close #31
This commit is contained in:
1 parent
02bd23d705
commit
97fc5d790a
8 files changed
+35
-9
No files matched your search
@@ -166,6 +166,7 @@ func receiveCommand(hc pb.NezhaService_HeartbeatClient) error {
|
||||
}
|
||||
|
||||
func reportState() {
|
||||
var lastReportHostInfo time.Time
|
||||
var err error
|
||||
defer log.Printf("reportState exit %v => %v", time.Now(), err)
|
||||
for {
|
||||
@@ -176,6 +177,10 @@ func reportState() {
|
||||
log.Printf("reportState error %v", err)
|
||||
time.Sleep(delayWhenError)
|
||||
}
|
||||
if lastReportHostInfo.Before(time.Now().Add(-10 * time.Minute)) {
|
||||
lastReportHostInfo = time.Now()
|
||||
client.Register(ctx, monitor.GetHost().PB())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user