Skip to content
Snippets Groups Projects
Commit b3e29062 authored by shen's avatar shen
Browse files

delete unused code

parent d4d4d092
No related branches found
No related tags found
No related merge requests found
......@@ -48,9 +48,7 @@ const (
)
var (
// 16 would be enough. We won't use concurrentMap because in most cases, there are not race condition
instanceMap = make(map[string]registry.ServiceDiscovery, 16)
initLock sync.Mutex
initLock sync.Mutex
)
// init will put the service discovery into extension
......@@ -61,20 +59,6 @@ func init() {
// newConsulServiceDiscovery will create new service discovery instance
// use double-check pattern to reduce race condition
func newConsulServiceDiscovery(name string) (registry.ServiceDiscovery, error) {
instance, ok := instanceMap[name]
if ok {
return instance, nil
}
initLock.Lock()
defer initLock.Unlock()
// double check
instance, ok = instanceMap[name]
if ok {
return instance, nil
}
sdc, ok := config.GetBaseConfig().GetServiceDiscoveries(name)
if !ok || len(sdc.RemoteRef) == 0 {
return nil, perrors.New("could not init the instance because the config is invalid")
......@@ -94,9 +78,7 @@ func newConsulServiceDiscovery(name string) (registry.ServiceDiscovery, error) {
}, nil
}
// nacosServiceDiscovery is the implementation of service discovery based on nacos.
// There is a problem, the go client for nacos does not support the id field.
// we will use the metadata to store the id of ServiceInstance
// consulServiceDiscovery is the implementation of service discovery based on consul.
type consulServiceDiscovery struct {
group string
// descriptor is a short string about the basic information of this instance
......
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