Skip to content

Commit

Permalink
fix(agent): close connection before reconnecting (#3373)
Browse files Browse the repository at this point in the history
* fix: close connection before reconnecting

* ensure conn is not nil
  • Loading branch information
mathnogueira committed Nov 17, 2023
1 parent a369d6e commit faf1159
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions agent/client/client.go
Expand Up @@ -163,6 +163,10 @@ func isCancelledError(err error) bool {
}

func (c *Client) reconnect() error {
if c.conn != nil {
c.conn.Close()
}

// connection is not working. We need to reconnect
err := retry.Do(func() error {
return c.connect(context.Background())
Expand Down

0 comments on commit faf1159

Please sign in to comment.