retry until all options are exhausted

This commit is contained in:
Chelsea Holland Komlo
2018-05-07 11:02:33 -04:00
parent 9e78d227e5
commit d00e096073

View File

@@ -56,6 +56,7 @@ func (r *retryJoiner) RetryJoin(config *Config) {
for {
var addrs []string
var err error
for _, addr := range config.Server.RetryJoin {
switch {
@@ -71,16 +72,15 @@ func (r *retryJoiner) RetryJoin(config *Config) {
}
}
if len(addrs) == 0 {
r.logger.Printf("[INFO] agent: Join completed. no addresses specified to sync with")
return
if len(addrs) > 0 {
n, err := r.join(addrs)
if err == nil {
r.logger.Printf("[INFO] agent: Join completed. Synced with %d initial agents", n)
}
}
n, err := r.join(addrs)
if err == nil {
r.logger.Printf("[INFO] agent: Join completed. Synced with %d initial agents", n)
return
if len(addrs) == 0 {
r.logger.Printf("[INFO] agent: Join completed. no addresses specified to sync with")
}
attempt++