diff --git a/weed/server/raft_server.go b/weed/server/raft_server.go index 09141ab0d..5f27a3a0e 100644 --- a/weed/server/raft_server.go +++ b/weed/server/raft_server.go @@ -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