优化RPC连接

This commit is contained in:
刘祥超
2020-11-13 18:22:56 +08:00
parent c96e32e257
commit 0aba473099
2 changed files with 9 additions and 0 deletions

View File

@@ -190,6 +190,11 @@ func (this *RPCClient) pickConn() *grpc.ClientConn {
if len(availableConns) > 0 {
return availableConns[rands.Int(0, len(availableConns)-1)]
}
// 关闭
for _, conn := range this.conns {
_ = conn.Close()
}
}
// 重新初始化