code: func (a *Autopilot) handlePromotions(promotions []raft.Server) error {
  	// This used to wait to only promote to maintain an odd quorum of
  	// servers, but this was at odds with the dead server cleanup when doing
  	// rolling updates (add one new server, wait, and then kill an old
  	// server). The dead server cleanup would still count the old server as
  	// a peer, which is conservative and the right thing to do, and this
  	// would wait to promote, so you could get into a stalemate. It is safer
  	// to promote early than remove early, so by promoting as soon as
  	// possible we have chosen that as the solution here.
  	for _, server := range promotions {
  		a.logger.Printf("[INFO] autopilot: Promoting %s to voter", fmtServer(server))
  		addFuture := a.delegate.Raft().AddVoter(server.ID, server.Address, 0, 0)
  		if err := addFuture.Error(); err != nil {
  			return fmt.Errorf("failed to add raft peer: %v", err)
  		}
  	}
  
  	// If we promoted a server, trigger a check to remove dead servers.
  	if len(promotions) > 0 {
  		select {
  		case a.removeDeadCh <- struct{}{}:
  		default:
  		}
  	}
  	return nil
  }
docs: // handlePromotions is a helper shared with Consul Enterprise that attempts to
  // apply desired server promotions to the Raft configuration.