in proxy/protocol/dubbo/schema/schema.go [179:200]
func GetSvcByInterface(interfaceName string) *registry.MicroService {
value, ok := svcToInterfaceCache.Get(interfaceName)
if !ok || value == nil {
openlog.Info(fmt.Sprintf("Get svc from remote, interface: %s", interfaceName))
svc := registry.DefaultContractDiscoveryService.GetMicroServicesByInterface(interfaceName)
if svc != nil {
svcKey := strings.Join([]string{svc[0].ServiceName, svc[0].Version, svc[0].AppID}, "/")
openlog.Info(fmt.Sprintf("Cached svc [%s] for interface %s", svcKey, interfaceName))
svcToInterfaceCache.Set(interfaceName, svc[0], 0)
refresher.Add(newInterfaceJob(interfaceName))
} else {
return nil
}
value, ok = svcToInterfaceCache.Get(interfaceName)
}
if value != nil {
if service, ok2 := value.(*registry.MicroService); ok2 {
return service
}
}
return nil
}