mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-18 23:10:25 +08:00
发送远程指令时包括从节点
This commit is contained in:
@@ -35,7 +35,8 @@ func SendMessageToCluster(ctx context.Context, clusterId int64, code string, msg
|
|||||||
|
|
||||||
// 获取所有节点
|
// 获取所有节点
|
||||||
nodesResp, err := defaultRPCClient.NodeRPC().FindAllEnabledNodesWithNodeClusterId(ctx, &pb.FindAllEnabledNodesWithNodeClusterIdRequest{
|
nodesResp, err := defaultRPCClient.NodeRPC().FindAllEnabledNodesWithNodeClusterId(ctx, &pb.FindAllEnabledNodesWithNodeClusterIdRequest{
|
||||||
NodeClusterId: clusterId,
|
NodeClusterId: clusterId,
|
||||||
|
IncludeSecondary: true,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return results, err
|
return results, err
|
||||||
@@ -45,10 +46,10 @@ func SendMessageToCluster(ctx context.Context, clusterId int64, code string, msg
|
|||||||
return results, nil
|
return results, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
rpcMap := map[int64]*rpc.RPCClient{} // apiNodeId => RPCClient
|
var rpcMap = map[int64]*rpc.RPCClient{} // apiNodeId => RPCClient
|
||||||
locker := &sync.Mutex{}
|
var locker = &sync.Mutex{}
|
||||||
|
|
||||||
wg := &sync.WaitGroup{}
|
var wg = &sync.WaitGroup{}
|
||||||
wg.Add(len(nodes))
|
wg.Add(len(nodes))
|
||||||
|
|
||||||
for _, node := range nodes {
|
for _, node := range nodes {
|
||||||
|
|||||||
Reference in New Issue
Block a user