优化RPC客户端锁

This commit is contained in:
刘祥超
2021-11-20 19:17:57 +08:00
parent 749e0bd0b3
commit 40cb1916c2

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 {