mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-11-06 10:00:25 +08:00
自动同步API节点配置
This commit is contained in:
@@ -158,6 +158,12 @@ func (this *RPCClient) Close() {
|
||||
}
|
||||
}
|
||||
|
||||
// 修改配置
|
||||
func (this *RPCClient) UpdateConfig(config *configs.APIConfig) error {
|
||||
this.apiConfig = config
|
||||
return this.init()
|
||||
}
|
||||
|
||||
// 初始化
|
||||
func (this *RPCClient) init() error {
|
||||
// 重新连接
|
||||
@@ -185,6 +191,8 @@ func (this *RPCClient) init() error {
|
||||
if len(conns) == 0 {
|
||||
return errors.New("[RPC]no available endpoints")
|
||||
}
|
||||
|
||||
// 这里不需要加锁,防止和pickConn()冲突
|
||||
this.conns = conns
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user