Adding aliases that automatically gets added

This commit is contained in:
Tim Beatham
2023-11-17 19:05:21 +00:00
parent 2c5289afb0
commit f6160fe138
16 changed files with 305 additions and 13 deletions

View File

@@ -30,6 +30,11 @@ type SyncerImpl struct {
// Sync: Sync random nodes
func (s *SyncerImpl) Sync(meshId string) error {
if !s.manager.HasChanges(meshId) && s.infectionCount == 0 {
logging.Log.WriteInfof("No changes for %s", meshId)
return nil
}
logging.Log.WriteInfof("UPDATING WG CONF")
err := s.manager.ApplyConfig()
@@ -37,11 +42,6 @@ func (s *SyncerImpl) Sync(meshId string) error {
logging.Log.WriteInfof("Failed to update config %w", err)
}
if !s.manager.HasChanges(meshId) && s.infectionCount == 0 {
logging.Log.WriteInfof("No changes for %s", meshId)
return nil
}
theMesh := s.manager.GetMesh(meshId)
if theMesh == nil {
@@ -50,6 +50,8 @@ func (s *SyncerImpl) Sync(meshId string) error {
snapshot, err := theMesh.GetMesh()
s.manager.GetMonitor().Trigger(meshId, snapshot)
if err != nil {
return err
}
@@ -111,6 +113,14 @@ func (s *SyncerImpl) Sync(meshId string) error {
logging.Log.WriteInfof("SYNC COUNT: %d", s.syncCount)
s.infectionCount = ((s.conf.InfectionCount + s.infectionCount - 1) % s.conf.InfectionCount)
newMesh := s.manager.GetMesh(meshId)
snapshot, err = newMesh.GetMesh()
if err != nil {
return err
}
return nil
}