优化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

@@ -42,7 +42,7 @@ func (this *UpdateHostsAction) RunPost(params struct {
},
NodeId: params.NodeId,
Secret: params.NodeSecret,
})
}, false)
if err != nil {
this.FailField("host", "测试API节点时出错请检查配置错误信息"+err.Error())
}
@@ -51,6 +51,10 @@ func (this *UpdateHostsAction) RunPost(params struct {
this.FailField("host", "无法连接此API节点错误信息"+err.Error())
}
defer func() {
_ = client.Close()
}()
// 获取管理员节点信息
apiTokensResp, err := client.APITokenRPC().FindAllEnabledAPITokens(client.APIContext(0), &pb.FindAllEnabledAPITokensRequest{Role: "admin"})
if err != nil {

View File

@@ -49,10 +49,15 @@ func (this *ValidateApiAction) RunPost(params struct {
},
NodeId: params.NodeId,
Secret: params.NodeSecret,
})
}, false)
if err != nil {
this.FailField("host", "测试API节点时出错请检查配置错误信息"+err.Error())
}
defer func() {
_ = client.Close()
}()
_, err = client.APINodeRPC().FindCurrentAPINodeVersion(client.APIContext(0), &pb.FindCurrentAPINodeVersionRequest{})
if err != nil {
this.FailField("host", "无法连接此API节点错误信息"+err.Error())