支持商业版本状态查询

This commit is contained in:
刘祥超
2023-03-31 14:06:01 +08:00
parent d124c9be18
commit 964524816f
3 changed files with 23 additions and 3 deletions

View File

@@ -55,6 +55,7 @@ var nodeConfigChangedNotify = make(chan bool, 8)
var nodeConfigUpdatedAt int64
var DaemonIsOn = false
var DaemonPid = 0
var nodeInstance *Node
// Node 节点
type Node struct {
@@ -79,12 +80,13 @@ type Node struct {
}
func NewNode() *Node {
return &Node{
nodeInstance = &Node{
sock: gosock.NewTmpSock(teaconst.ProcessName),
oldMaxThreads: -1,
oldMaxCPU: -1,
updatingServerMap: map[int64]*serverconfigs.ServerConfig{},
}
return nodeInstance
}
// Test 检查配置
@@ -458,6 +460,11 @@ func (this *Node) execTask(rpcClient *rpc.RPCClient, task *pb.NodeTask) error {
}
}
}
case "plusChanged":
err := this.notifyPlusChange()
if err != nil {
return err
}
default:
remotelogs.Error("NODE", "task '"+types.String(task.Id)+"', type '"+task.Type+"' has not been handled")
}
@@ -1188,6 +1195,9 @@ func (this *Node) onReload(config *nodeconfigs.NodeConfig, reloadAll bool) {
// API Node地址这里不限制是否为空因为在为空时仍然要有对应的处理
this.changeAPINodeAddrs(config.APINodeAddrs)
}
// 刷新IP库
this.reloadIPLibrary()
}
// reload server config
@@ -1205,10 +1215,10 @@ func (this *Node) reloadServer() {
}
for serverId, serverConfig := range updatingServerMap {
if serverConfig != nil {
remotelogs.Debug("NODE", "load server '" + types.String(serverId) + "'")
remotelogs.Debug("NODE", "load server '"+types.String(serverId)+"'")
newNodeConfig.AddServer(serverConfig)
} else {
remotelogs.Debug("NODE", "remove server '" + types.String(serverId) + "'")
remotelogs.Debug("NODE", "remove server '"+types.String(serverId)+"'")
newNodeConfig.RemoveServer(serverId)
}
}

View File

@@ -7,3 +7,11 @@ package nodes
func (this *Node) reloadCommonScripts() error {
return nil
}
func (this *Node) reloadIPLibrary() {
}
func (this *Node) notifyPlusChange() error {
return nil
}

View File

@@ -51,6 +51,7 @@ type RPCClient struct {
ScriptRPC pb.ScriptServiceClient
UserRPC pb.UserServiceClient
ClientAgentIPRPC pb.ClientAgentIPServiceClient
AuthorityKeyRPC pb.AuthorityKeyServiceClient
}
func NewRPCClient(apiConfig *configs.APIConfig) (*RPCClient, error) {
@@ -85,6 +86,7 @@ func NewRPCClient(apiConfig *configs.APIConfig) (*RPCClient, error) {
client.ScriptRPC = pb.NewScriptServiceClient(client)
client.UserRPC = pb.NewUserServiceClient(client)
client.ClientAgentIPRPC = pb.NewClientAgentIPServiceClient(client)
client.AuthorityKeyRPC = pb.NewAuthorityKeyServiceClient(client)
err := client.init()
if err != nil {