mirror of https://github.com/tikv/client-go.git
fix context leak in BatchDelete (#704)
Signed-off-by: Ping Yu <yuping@pingcap.com>
This commit is contained in:
parent
95ebf6a863
commit
b3c491995e
|
|
@ -750,9 +750,9 @@ func (c *Client) sendBatchReq(bo *retry.Backoffer, keys [][]byte, options *rawOp
|
|||
singleResp, ok := <-ches
|
||||
if ok {
|
||||
if singleResp.Error != nil {
|
||||
cancel()
|
||||
if firstError == nil {
|
||||
firstError = errors.WithStack(singleResp.Error)
|
||||
cancel()
|
||||
}
|
||||
} else if cmdType == tikvrpc.CmdRawBatchGet {
|
||||
cmdResp := singleResp.Resp.(*kvrpcpb.RawBatchGetResponse)
|
||||
|
|
@ -761,6 +761,9 @@ func (c *Client) sendBatchReq(bo *retry.Backoffer, keys [][]byte, options *rawOp
|
|||
}
|
||||
}
|
||||
|
||||
if firstError == nil {
|
||||
cancel()
|
||||
}
|
||||
return resp, firstError
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue