Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

client_batch: tiny optimize #834

Merged
merged 3 commits into from
Jun 12, 2023
Merged

Conversation

crazycs520
Copy link
Contributor

@crazycs520 crazycs520 commented Jun 12, 2023

tiny optimize for #833

Signed-off-by: crazycs520 <crazycs520@gmail.com>
@cfzjywxk cfzjywxk requested review from cfzjywxk and zyguan June 12, 2023 02:37
@@ -549,14 +549,15 @@ func (c *batchCommandsClient) waitConnReady() (err error) {
metrics.TiKVBatchClientWaitEstablish.Observe(time.Since(start).Seconds())
}()
dialCtx, cancel := context.WithTimeout(context.Background(), c.dialTimeout)
// Trigger idle connection to reconnection
// Put it outside loop to avoid unnecessary reconnecting.
c.conn.Connect()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about to check the state here? We only need to call Connect when the state is IDLE.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, done.

Signed-off-by: crazycs520 <crazycs520@gmail.com>
Signed-off-by: crazycs520 <crazycs520@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants