feat(node): add GetNodeCount to get node count and remove no need node update log, only log when node count changed
This commit is contained in:
@@ -260,11 +260,15 @@ func startBackgroundTasks(_ *config.Config) {
|
||||
if client == nil {
|
||||
continue
|
||||
}
|
||||
orgNodeCount := node.GetTracker().GetNodeCount()
|
||||
nodes, err := client.FetchNodes()
|
||||
if err != nil {
|
||||
postLog.Warning("Failed to refresh node list: " + err.Error())
|
||||
continue
|
||||
}
|
||||
if node.GetTracker().GetNodeCount() != orgNodeCount {
|
||||
postLog.Info(fmt.Sprintf("Refreshed node list: %d nodes", len(nodes)))
|
||||
}
|
||||
tracker := node.GetTracker()
|
||||
if tracker != nil {
|
||||
tracker.UpdateNodeList(komari.BuildNodeListData(nodes))
|
||||
|
||||
Reference in New Issue
Block a user