CAICAIIs commented on code in PR #1126:
URL: 
https://github.com/apache/incubator-seata-go/pull/1126#discussion_r3487177472


##########
pkg/discovery/etcd3.go:
##########
@@ -218,41 +194,20 @@ func getClusterAndAddress(key []byte) (string, string, 
int, error) {
        return cluster, ip, port, nil
 }
 
-func ifHaveSameServiceInstances(list []*ServiceInstance, value 
*ServiceInstance) bool {
-       for _, v := range list {
-               if v.Addr == value.Addr && v.Port == value.Port {
-                       return true
-               }
-       }
-       return false
-}
-
-func removeValueFromList(list []*ServiceInstance, ip string, port int) 
[]*ServiceInstance {
-       for k, v := range list {
-               if v.Addr == ip && v.Port == port {
-                       result := list[:k]
-                       if k < len(list)-1 {
-                               result = append(result, list[k+1:]...)
-                       }
-                       return result
-               }
-       }
-
-       return list
-}
-
 func (s *EtcdRegistryService) Lookup(key string) ([]*ServiceInstance, error) {
-       s.rwLock.RLock()
-       defer s.rwLock.RUnlock()
        cluster := s.vgroupMapping[key]
        if cluster == "" {
                return nil, fmt.Errorf("cluster doesnt exit")
        }
 
-       list := s.grouplist[cluster]
-       return list, nil
+       return s.store.Snapshot(cluster), nil
 }
 
 func (s *EtcdRegistryService) Close() {

Review Comment:
   done, thx , can you have a another look?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to