consul: Leave does a RemovePeer RPC call
This commit is contained in:
parent
a8a9d2cd45
commit
08152dc66b
|
@ -293,13 +293,12 @@ func (s *Server) Leave() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Request that we are removed
|
// Request that we are removed
|
||||||
// TODO: Properly forward to leader
|
|
||||||
future := s.raft.RemovePeer(s.rpcListener.Addr())
|
|
||||||
|
|
||||||
// Wait for the future
|
|
||||||
ch := make(chan error, 1)
|
ch := make(chan error, 1)
|
||||||
go func() {
|
go func() {
|
||||||
ch <- future.Error()
|
var out struct{}
|
||||||
|
peer := s.rpcListener.Addr().String()
|
||||||
|
err := s.connPool.RPC(leader, "Raft.RemovePeer", peer, &out)
|
||||||
|
ch <- err
|
||||||
}()
|
}()
|
||||||
|
|
||||||
// Wait for the commit
|
// Wait for the commit
|
||||||
|
|
Loading…
Reference in a new issue