server.MemberCount: count peers with len() is cheaper than loop
parent
f9ec2ed5eb
commit
19ad97520b
|
@ -189,11 +189,7 @@ func (s *Server) LastCommandName() string {
|
|||
|
||||
// Retrieves the number of member servers in the consensus.
|
||||
func (s *Server) MemberCount() int {
|
||||
count := 1
|
||||
for _, _ = range s.peers {
|
||||
count++
|
||||
}
|
||||
return count
|
||||
return len(s.peers) + 1
|
||||
}
|
||||
|
||||
// Retrieves the number of servers required to make a quorum.
|
||||
|
|
Loading…
Reference in New Issue