mirror of
https://github.com/duanhf2012/origin.git
synced 2026-02-04 06:54:45 +08:00
1.优化服务配置检查
2.废弃SetGoRoutineNum接口 3.释放Module优化
This commit is contained in:
@@ -417,13 +417,12 @@ func (cls *Cluster) readLocalService(localNodeId string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (cls *Cluster) parseLocalCfg() {
|
||||
func (cls *Cluster) parseLocalCfg() error{
|
||||
rpcInfo := NodeRpcInfo{}
|
||||
rpcInfo.nodeInfo = cls.localNodeInfo
|
||||
rpcInfo.client = rpc.NewLClient(rpcInfo.nodeInfo.NodeId, &cls.callSet)
|
||||
|
||||
cls.mapRpc[cls.localNodeInfo.NodeId] = &rpcInfo
|
||||
|
||||
for _, serviceName := range cls.localNodeInfo.ServiceList {
|
||||
splitServiceName := strings.Split(serviceName, ":")
|
||||
if len(splitServiceName) == 2 {
|
||||
@@ -440,8 +439,13 @@ func (cls *Cluster) parseLocalCfg() {
|
||||
cls.mapServiceNode[serviceName] = make(map[string]struct{})
|
||||
}
|
||||
|
||||
if _,ok:=cls.mapServiceNode[serviceName][cls.localNodeInfo.NodeId];ok {
|
||||
return fmt.Errorf("duplicate service %s is configured in node %s", serviceName, cls.localNodeInfo.NodeId)
|
||||
}
|
||||
cls.mapServiceNode[serviceName][cls.localNodeInfo.NodeId] = struct{}{}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (cls *Cluster) IsNatsMode() bool {
|
||||
@@ -474,8 +478,7 @@ func (cls *Cluster) InitCfg(localNodeId string) error {
|
||||
}
|
||||
|
||||
//本地配置服务加到全局map信息中
|
||||
cls.parseLocalCfg()
|
||||
return nil
|
||||
return cls.parseLocalCfg()
|
||||
}
|
||||
|
||||
func (cls *Cluster) IsConfigService(serviceName string) bool {
|
||||
|
||||
Reference in New Issue
Block a user