fix context leak in rawkv.BatchPut (#697)

Signed-off-by: Ping Yu <yuping@pingcap.com>
This commit is contained in:
Ping Yu 2023-02-08 11:19:21 +08:00 committed by GitHub
parent 29dfcc2729
commit 9b06301c47
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -899,13 +899,17 @@ func (c *Client) sendBatchPut(bo *retry.Backoffer, keys, values [][]byte, ttls [
for i := 0; i < len(batches); i++ {
if e := <-ch; e != nil {
cancel()
// catch the first error
if err == nil {
err = errors.WithStack(e)
cancel()
}
}
}
if err == nil {
cancel()
}
return err
}