Skip to content

Commit

Permalink
tikvclient: fix a bug that recreate connection forever (#10301)
Browse files Browse the repository at this point in the history
  • Loading branch information
hicqu authored and zz-jason committed Apr 30, 2019
1 parent cf0ca74 commit b29e19f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions store/tikv/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,13 @@ func (c *batchCommandsClient) batchRecvLoop(cfg config.TiKVClient) {
// When `conn.Close()` is called, `client.Recv()` will return an error.
resp, err := c.client.Recv()
if err != nil {
if c.isStopped() {
return
}
logutil.Logger(context.Background()).Error("batchRecvLoop error when receive", zap.Error(err))

now := time.Now()
for { // try to re-create the streaming in the loop.
if c.isStopped() {
return
}
// Hold the lock to forbid batchSendLoop using the old client.
c.clientLock.Lock()
c.failPendingRequests(err) // fail all pending requests.
Expand Down

0 comments on commit b29e19f

Please sign in to comment.