fix(registry): fetch peers from store instead of cache

The current cache implmentation may contain removed machines, so we
fetch peers from store for correctness.
This commit is contained in:
Yicheng Qin
2014-05-07 14:33:30 -07:00
parent b56aa62bcc
commit 0558b546ff
2 changed files with 12 additions and 14 deletions

View File

@@ -737,8 +737,8 @@ func (s *PeerServer) monitorActiveSize() {
// Retrieve target active size and actual active size.
activeSize := s.ClusterConfig().ActiveSize
peerCount := s.registry.Count()
peers := s.registry.Names()
peerCount := s.registry.Count()
if index := sort.SearchStrings(peers, s.Config.Name); index < len(peers) && peers[index] == s.Config.Name {
peers = append(peers[:index], peers[index+1:]...)
}