mirror of https://github.com/status-im/consul.git
Do not leave raft pool if we are the only member
This commit is contained in:
parent
3c7a06bb80
commit
682a986ae8
|
@ -301,6 +301,13 @@ func (s *Server) Leave() error {
|
|||
|
||||
// Leave the Raft cluster
|
||||
if s.raft != nil {
|
||||
// Check if we have other raft nodes
|
||||
peers, _ := s.raftPeers.Peers()
|
||||
if len(peers) <= 1 {
|
||||
s.logger.Printf("[WARN] Not leaving Raft cluster, no peers")
|
||||
goto AFTER_LEAVE
|
||||
}
|
||||
|
||||
// Get the leader
|
||||
leader := s.raft.Leader()
|
||||
if leader == nil {
|
||||
|
|
Loading…
Reference in New Issue