Skip to content
Snippets Groups Projects
Commit 6590c0bf authored by Ian Luo's avatar Ian Luo
Browse files

re-connect if necessary to make sure the clienbt is available.

parent 042387da
No related branches found
No related tags found
No related merge requests found
......@@ -204,12 +204,10 @@ func (c *Client) Request(request *remoting.Request, timeout time.Duration, respo
return perrors.WithStack(err)
}
// isAvailable returns true if the connection is available, or it can be re-established.
func (c *Client) IsAvailable() bool {
client, err := c.pool.get()
if client == nil || !client.isAvailable() || err != nil {
return false
}
return true
_, _, err := c.selectSession(c.addr)
return err == nil
}
func (c *Client) selectSession(addr string) (*gettyRPCClient, getty.Session, error) {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment