优化RPC连接

This commit is contained in:
GoEdgeLab
2021-11-10 22:22:27 +08:00
parent 55cefdb62c
commit 6116fa4f3e
7 changed files with 58 additions and 10 deletions

View File

@@ -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{