Skip to content
Snippets Groups Projects
Commit 744afb25 authored by flycash's avatar flycash
Browse files

Fix Review

parent f433c063
No related branches found
No related tags found
No related merge requests found
......@@ -263,9 +263,9 @@ func (s *serviceDiscoveryRegistry) Subscribe(url *common.URL, notify registry.No
}
s.registerServiceInstancesChangedListener(*url, listener)
}
return nil
}
func (s *serviceDiscoveryRegistry) registerServiceInstancesChangedListener(url common.URL, listener *registry.ServiceInstancesChangedListener) {
listenerId := listener.ServiceName + ":" + getUrlKey(url)
if !s.subscribedServices.Contains(listenerId) {
......@@ -335,6 +335,7 @@ func (s *serviceDiscoveryRegistry) synthesizeSubscribedURLs(subscribedURL *commo
}
return urls
}
func shouldSubscribe(url common.URL) bool {
return !shouldRegister(url)
}
......
......@@ -22,8 +22,6 @@ import (
"path"
"strings"
"sync"
"github.com/dubbogo/go-zookeeper/zk"
)
import (
......@@ -31,6 +29,8 @@ import (
)
import (
"github.com/dubbogo/go-zookeeper/zk"
"github.com/apache/dubbo-go/common/constant"
"github.com/apache/dubbo-go/common/logger"
"github.com/apache/dubbo-go/remoting"
......@@ -119,14 +119,17 @@ func (sd *ServiceDiscovery) UpdateService(instance *ServiceInstance) error {
if !ok {
return perrors.New("[ServiceDiscovery] services value not entry")
}
entry.Lock()
defer entry.Unlock()
entry.instance = instance
path := sd.pathForInstance(instance.Name, instance.Id)
data, err := json.Marshal(instance)
if err != nil {
return err
}
entry.Lock()
defer entry.Unlock()
entry.instance = instance
path := sd.pathForInstance(instance.Name, instance.Id)
_, err = sd.client.SetContent(path, data, -1)
if err != nil {
return err
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment