|
@@ -18,10 +18,17 @@ import (
|
|
|
|
|
|
var batchSize = servercfg.GetPeerUpdateBatchSize()
|
|
|
var batchUpdate = servercfg.GetBatchPeerUpdate()
|
|
|
+var peerUpdateTS = time.Now().Unix()
|
|
|
|
|
|
// PublishPeerUpdate --- determines and publishes a peer update to all the hosts
|
|
|
func PublishPeerUpdate(replacePeers bool) error {
|
|
|
slog.Error("entering PublishPeerUpdate", "Debug")
|
|
|
+ t1 := time.Now().Unix()
|
|
|
+ if time.Now().Unix()-peerUpdateTS < 60 {
|
|
|
+ return nil
|
|
|
+ }
|
|
|
+ peerUpdateTS = time.Now().Unix()
|
|
|
+
|
|
|
pc, file, no, ok := runtime.Caller(1)
|
|
|
if ok {
|
|
|
slog.Error("called from ", file, no)
|
|
@@ -85,7 +92,7 @@ func PublishPeerUpdate(replacePeers bool) error {
|
|
|
}
|
|
|
wg.Wait()
|
|
|
}
|
|
|
- slog.Error("leaving PublishPeerUpdate", "Debug")
|
|
|
+ slog.Error("leaving PublishPeerUpdate, time cost: ", "Debug", time.Now().Unix()-t1)
|
|
|
return nil
|
|
|
}
|
|
|
|