simplify a bit

This commit is contained in:
chrislu 2022-03-26 10:24:05 -07:00
parent a3411dd9da
commit fba1cfc2d6

View file

@ -118,15 +118,7 @@ func NewRaftServer(option *RaftServerOption) (*RaftServer, error) {
// Remove deleted peers
for existsPeerName := range s.raftServer.Peers() {
exists := false
var existingPeer pb.ServerAddress
for name, peer := range s.peers {
if name == existsPeerName {
exists, existingPeer = true, peer
break
}
}
if !exists {
if existingPeer, found := s.peers[existsPeerName]; !found {
if err := s.raftServer.RemovePeer(existsPeerName); err != nil {
glog.V(0).Infoln(err)
return nil, err