- Done
This commit is contained in:
Tim Beatham 2024-01-18 10:50:59 +00:00
parent 664e54b710
commit b6fe352553

View File

@ -97,20 +97,12 @@ func (s *SyncerImpl) Sync(correspondingMesh mesh.MeshProvider) (bool, error) {
var succeeded bool = false
var wait sync.WaitGroup
for index := range gossipNodes {
wait.Add(1)
syncNode := func(i int) {
node := gossipNodes[i]
for _, node := range gossipNodes {
correspondingPeer, err := correspondingMesh.GetNode(node)
defer wait.Done()
if correspondingPeer == nil || err != nil {
logging.Log.WriteErrorf("node %s does not exist", node)
return
continue
}
err = s.requester.SyncMesh(correspondingMesh, correspondingPeer)
@ -124,11 +116,6 @@ func (s *SyncerImpl) Sync(correspondingMesh mesh.MeshProvider) (bool, error) {
}
}
go syncNode(index)
}
wait.Wait()
s.syncCount++
logging.Log.WriteInfof("sync time: %v", time.Since(before))
logging.Log.WriteInfof("number of syncs: %d", s.syncCount)