mirror of
https://github.com/alibaba/higress.git
synced 2026-06-08 20:27:31 +08:00
When the service source type is nacos3, if mcpserver is turned off, then the discovery mechanism of nacos2 will be enabled (#2150)
This commit is contained in:
@@ -111,9 +111,10 @@ func NewWatcher(cache memory.Cache, opts ...WatcherOption) (provider.Watcher, er
|
||||
opt(w)
|
||||
}
|
||||
|
||||
if w.NacosNamespace == "" {
|
||||
w.NacosNamespace = w.NacosNamespaceId
|
||||
}
|
||||
// The nacos mcp server uses these restricted namespaces and groups, and may be adjusted in the future.
|
||||
w.NacosNamespace = "nacos-default-mcp"
|
||||
w.NacosNamespaceId = w.NacosNamespace
|
||||
w.NacosGroups = []string{"mcp-server"}
|
||||
|
||||
mcpServerLog.Infof("new nacos mcp server watcher with config Name:%s", w.Name)
|
||||
|
||||
@@ -177,32 +178,6 @@ func WithNacosSecretKey(nacosSecretKey string) WatcherOption {
|
||||
}
|
||||
}
|
||||
|
||||
func WithNacosNamespaceId(nacosNamespaceId string) WatcherOption {
|
||||
return func(w *watcher) {
|
||||
if nacosNamespaceId == "" {
|
||||
w.NacosNamespaceId = "nacos-default-mcp"
|
||||
} else {
|
||||
w.NacosNamespaceId = nacosNamespaceId
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func WithNacosNamespace(nacosNamespace string) WatcherOption {
|
||||
return func(w *watcher) {
|
||||
w.NacosNamespace = nacosNamespace
|
||||
}
|
||||
}
|
||||
|
||||
func WithNacosGroups(nacosGroups []string) WatcherOption {
|
||||
return func(w *watcher) {
|
||||
if len(nacosGroups) == 0 {
|
||||
w.NacosGroups = []string{"mcp-server"}
|
||||
} else {
|
||||
w.NacosGroups = nacosGroups
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func WithNacosRefreshInterval(refreshInterval int64) WatcherOption {
|
||||
return func(w *watcher) {
|
||||
if refreshInterval < int64(DefaultRefreshIntervalLimit) {
|
||||
@@ -967,7 +942,8 @@ func (w *watcher) Stop() {
|
||||
}
|
||||
mcpServerLog.Infof("stop all service nameing client")
|
||||
for _, client := range w.serviceCache {
|
||||
client.Stop()
|
||||
// TODO: This is a temporary implementation because of a bug in the nacos-go-sdk, which causes a block when stoping.
|
||||
go client.Stop()
|
||||
}
|
||||
|
||||
w.isStop = true
|
||||
|
||||
Reference in New Issue
Block a user