mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-12-16 05:36:36 +08:00
优化RPC连接
This commit is contained in:
@@ -206,7 +206,7 @@ func (this *InstallAction) RunPost(params struct {
|
||||
|
||||
// 设置管理员
|
||||
currentStatusText = "正在设置管理员"
|
||||
client, err := rpc.NewRPCClient(apiConfig)
|
||||
client, err := rpc.NewRPCClient(apiConfig, false)
|
||||
if err != nil {
|
||||
this.FailField("oldHost", "测试API节点时出错,请检查配置,错误信息:"+err.Error())
|
||||
}
|
||||
@@ -263,11 +263,15 @@ func (this *InstallAction) RunPost(params struct {
|
||||
NodeId: apiNodeMap.GetString("oldNodeId"),
|
||||
Secret: apiNodeMap.GetString("oldNodeSecret"),
|
||||
}
|
||||
client, err := rpc.NewRPCClient(apiConfig)
|
||||
client, err := rpc.NewRPCClient(apiConfig, false)
|
||||
if err != nil {
|
||||
this.FailField("oldHost", "测试API节点时出错,请检查配置,错误信息:"+err.Error())
|
||||
}
|
||||
|
||||
defer func() {
|
||||
_ = client.Close()
|
||||
}()
|
||||
|
||||
// 设置管理员
|
||||
ctx := client.APIContext(0)
|
||||
_, err = client.AdminRPC().CreateOrUpdateAdmin(ctx, &pb.CreateOrUpdateAdminRequest{
|
||||
|
||||
@@ -91,10 +91,15 @@ func (this *ValidateApiAction) RunPost(params struct {
|
||||
},
|
||||
NodeId: params.OldNodeId,
|
||||
Secret: params.OldNodeSecret,
|
||||
})
|
||||
}, false)
|
||||
if err != nil {
|
||||
this.FailField("oldHost", "测试API节点时出错,请检查配置,错误信息:"+err.Error())
|
||||
}
|
||||
|
||||
defer func() {
|
||||
_ = client.Close()
|
||||
}()
|
||||
|
||||
_, err = client.APINodeRPC().FindCurrentAPINodeVersion(client.APIContext(0), &pb.FindCurrentAPINodeVersionRequest{})
|
||||
if err != nil {
|
||||
this.FailField("oldHost", "无法连接此API节点,错误信息:"+err.Error())
|
||||
|
||||
Reference in New Issue
Block a user