mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-12-15 12:46:34 +08:00
自动更新API节点配置
This commit is contained in:
@@ -342,6 +342,12 @@ func (this *RPCClient) APIContext(apiNodeId int64) context.Context {
|
||||
return ctx
|
||||
}
|
||||
|
||||
// 修改配置
|
||||
func (this *RPCClient) UpdateConfig(config *configs.APIConfig) error {
|
||||
this.apiConfig = config
|
||||
return this.init()
|
||||
}
|
||||
|
||||
// 初始化
|
||||
func (this *RPCClient) init() error {
|
||||
// 重新连接
|
||||
@@ -369,7 +375,9 @@ func (this *RPCClient) init() error {
|
||||
if len(conns) == 0 {
|
||||
return errors.New("[RPC]no available endpoints")
|
||||
}
|
||||
this.locker.Lock()
|
||||
this.conns = conns
|
||||
this.locker.Unlock()
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user