优化RPC客户端锁

This commit is contained in:
GoEdgeLab
2021-11-20 19:17:57 +08:00
parent d92c14d7ba
commit 3f5a6cf6fc

View File

@@ -231,8 +231,8 @@ func (this *RPCClient) init() error {
// 随机选择一个连接
func (this *RPCClient) pickConn() *grpc.ClientConn {
this.locker.RLock()
defer this.locker.RUnlock()
this.locker.Lock()
defer this.locker.Unlock()
// 检查连接状态
if len(this.conns) > 0 {