Skip to content

Commit a8956cc

Browse files
committed
Optimize health status retrieval by executing GetAllHealthStatus in a goroutine
1 parent d27c4d1 commit a8956cc

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

peer/peer.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ func (pm *PeerManager) BatchUpdateClusters(clusterUpdates []*PeerCluster, remove
171171

172172
// Update the health status of all clusters.
173173
if len(pm.PeerURL) > 0 {
174-
pm.GetAllHealthStatus()
174+
go pm.GetAllHealthStatus()
175175
}
176176
}
177177

server/server_git.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ func (repman *ReplicationManager) LoadPeerJson() error {
384384
modTime := fstat.ModTime()
385385

386386
if oldModTime, ok := repman.ModTimes["peer"]; ok && oldModTime.Equal(modTime) {
387-
repman.PeerManager.GetAllHealthStatus()
387+
go repman.PeerManager.GetAllHealthStatus()
388388
return nil // No changes in the file modification time
389389
}
390390

@@ -404,7 +404,7 @@ func (repman *ReplicationManager) LoadPeerJson() error {
404404

405405
// Compare with the existing checksum
406406
if oldHash, ok := repman.CheckSumConfig["peer"]; ok && bytes.Equal(oldHash.Sum(nil), newHash.Sum(nil)) {
407-
repman.PeerManager.GetAllHealthStatus()
407+
go repman.PeerManager.GetAllHealthStatus()
408408
return nil // No changes in the file content
409409
}
410410

0 commit comments

Comments
 (0)