code: func (c *Command) retryJoin(config *Config, agent *Agent, errCh chan struct{}) {
  	// Quit fast if there is no nodes to join
  	if len(config.RetryJoin) == 0 {
  		return
  	}
  
  	// Track the number of join attempts
  	attempt := 0
  	for {
  		// Try to perform the join
  		c.logger.Printf("[INFO] agent: Joining cluster...(replay: %v)", config.ReplayOnJoin)
  		n, err := agent.Join(config.RetryJoin, config.ReplayOnJoin)
  		if err == nil {
  			c.logger.Printf("[INFO] agent: Join completed. Synced with %d initial agents", n)
  			return
  		}
  
  		// Check if the maximum attempts has been exceeded
  		attempt++
  		if config.RetryMaxAttempts > 0 && attempt > config.RetryMaxAttempts {
  			c.logger.Printf("[ERR] agent: maximum retry join attempts made, exiting")
  			close(errCh)
  			return
  		}
  
  		// Log the failure and sleep
  		c.logger.Printf("[WARN] agent: Join failed: %v, retrying in %v", err, config.RetryInterval)
  		time.Sleep(config.RetryInterval)
  	}
  }
docs: // retryJoin is invoked to handle joins with retries. This runs until at least a
  // single successful join or RetryMaxAttempts is reached