mirror of https://github.com/tikv/client-go.git
internal/client: fix recycle idle connection block sending request (#270)
Signed-off-by: tiancaiamao <tiancaiamao@gmail.com>
This commit is contained in:
parent
b440ea2f58
commit
31906d4105
|
|
@ -365,9 +365,7 @@ func (c *RPCClient) SendRequest(ctx context.Context, addr string, req *tikvrpc.R
|
|||
|
||||
start := time.Now()
|
||||
if atomic.CompareAndSwapUint32(&c.idleNotify, 1, 0) {
|
||||
c.recycleMu.Lock()
|
||||
c.recycleIdleConnArray()
|
||||
c.recycleMu.Unlock()
|
||||
go c.recycleIdleConnArray()
|
||||
}
|
||||
|
||||
// TiDB will not send batch commands to TiFlash, to resolve the conflict with Batch Cop Request.
|
||||
|
|
|
|||
|
|
@ -795,6 +795,9 @@ func sendBatchRequest(
|
|||
}
|
||||
|
||||
func (c *RPCClient) recycleIdleConnArray() {
|
||||
c.recycleMu.Lock()
|
||||
defer c.recycleMu.Unlock()
|
||||
|
||||
var addrs []string
|
||||
c.RLock()
|
||||
for _, conn := range c.conns {
|
||||
|
|
|
|||
Loading…
Reference in New Issue