agent: Simplify the local state sync

pull/36/head
Armon Dadgar 2014-04-14 12:47:58 -07:00
parent dbbf60f8f8
commit d7d30f5cf5
1 changed files with 10 additions and 9 deletions

View File

@ -216,16 +216,17 @@ func (l *localState) antiEntropy(shutdownCh chan struct{}) {
SYNC:
// Sync our state with the servers
for {
if err := l.setSyncState(); err != nil {
l.logger.Printf("[ERR] agent: failed to sync remote state: %v", err)
select {
case <-l.consulCh:
case <-time.After(aeScale(syncRetryIntv, len(l.iface.LANMembers()))):
case <-shutdownCh:
return
}
err := l.setSyncState()
if err == nil {
break
}
l.logger.Printf("[ERR] agent: failed to sync remote state: %v", err)
select {
case <-l.consulCh:
case <-time.After(aeScale(syncRetryIntv, len(l.iface.LANMembers()))):
case <-shutdownCh:
return
}
break
}
// Force-trigger AE to pickup any changes