mirror of https://github.com/tikv/client-go.git
refine error msg (#1338)
* refine error msg Signed-off-by: crazycs520 <crazycs520@gmail.com> * refine Signed-off-by: crazycs520 <crazycs520@gmail.com> * fix test Signed-off-by: crazycs520 <crazycs520@gmail.com> --------- Signed-off-by: crazycs520 <crazycs520@gmail.com>
This commit is contained in:
parent
c82e921992
commit
e1ca512cca
|
|
@ -924,8 +924,8 @@ func sendBatchRequest(
|
|||
case <-timer.C:
|
||||
return nil, errors.WithMessage(context.DeadlineExceeded, "wait sendLoop")
|
||||
}
|
||||
waitDuration := time.Since(start)
|
||||
metrics.TiKVBatchWaitDuration.Observe(float64(waitDuration))
|
||||
waitSendDuration := time.Since(start)
|
||||
metrics.TiKVBatchWaitDuration.Observe(float64(waitSendDuration))
|
||||
|
||||
select {
|
||||
case res, ok := <-entry.res:
|
||||
|
|
@ -944,7 +944,8 @@ func sendBatchRequest(
|
|||
return nil, errors.New("batchConn closed")
|
||||
case <-timer.C:
|
||||
atomic.StoreInt32(&entry.canceled, 1)
|
||||
reason := fmt.Sprintf("wait recvLoop timeout,timeout:%s, wait_duration:%s:", timeout, waitDuration)
|
||||
reason := fmt.Sprintf("wait recvLoop timeout, timeout:%s, wait_send_duration:%s, wait_recv_duration:%s",
|
||||
timeout, util.FormatDuration(waitSendDuration), util.FormatDuration(time.Since(start)-waitSendDuration))
|
||||
return nil, errors.WithMessage(context.DeadlineExceeded, reason)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ func TestSendWhenReconnect(t *testing.T) {
|
|||
|
||||
req := tikvrpc.NewRequest(tikvrpc.CmdEmpty, &tikvpb.BatchCommandsEmptyRequest{})
|
||||
_, err = rpcClient.SendRequest(context.Background(), addr, req, 5*time.Second)
|
||||
require.Regexp(t, "wait recvLoop timeout,timeout:5s, wait_duration:.* context deadline exceeded", err.Error())
|
||||
require.Regexp(t, "wait recvLoop timeout, timeout:5s, wait_send_duration:.*, wait_recv_duration:.*: context deadline exceeded", err.Error())
|
||||
server.Stop()
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue