Skip to content

Commit

Permalink
Fix the retry delay
Browse files Browse the repository at this point in the history
Signed-off-by: JmPotato <[email protected]>
  • Loading branch information
JmPotato authored and ti-chi-bot committed Mar 19, 2024
1 parent a8b3bd4 commit c02e05f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,11 @@ func (c *client) dispatchTSORequestWithRetry(req *tsoRequest) error {
err error
)
for i := 0; i < dispatchRetryCount; i++ {
// Get the tsoClient for each retry, as it may be initialized or switched during the process.
// Do not delay for the first time.
if i > 0 {
time.Sleep(dispatchRetryDelay)
}
// Get the tsoClient each time, as it may be initialized or switched during the process.
tsoClient := c.getTSOClient()
if tsoClient == nil {
err = errs.ErrClientGetTSO.FastGenByArgs("tso client is nil")
Expand All @@ -812,7 +816,6 @@ func (c *client) dispatchTSORequestWithRetry(req *tsoRequest) error {
if !retryable {
break
}
time.Sleep(dispatchRetryDelay)
}
return err
}
Expand Down

0 comments on commit c02e05f

Please sign in to comment.