code: func (d *daemonDiscoveryReloader) initHeartbeat(address string) error {
  	// Setup a short ticker until the first heartbeat has succeeded
  	t := time.NewTicker(500 * time.Millisecond)
  	defer t.Stop()
  	// timeout makes sure that after a period of time we stop being so aggressive trying to reach the discovery service
  	timeout := time.After(60 * time.Second)
  
  	for {
  		select {
  		case <-timeout:
  			return errors.New("timeout waiting for initial discovery")
  		case <-d.term:
  			return errors.New("terminated")
  		case <-t.C:
  			if err := d.backend.Register(address); err == nil {
  				return nil
  			}
  		}
  	}
  }
docs: // initHeartbeat is used to do the first heartbeat. It uses a tight loop until
  // either the timeout period is reached or the heartbeat is successful and returns.