Skip to content

Commit

Permalink
fix: make closing connection not reconnect and actually kill the rout…
Browse files Browse the repository at this point in the history
…ine (#3682)
  • Loading branch information
mathnogueira committed Feb 27, 2024
1 parent 9bfa704 commit 26882e4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions agent/client/client.go
Expand Up @@ -197,7 +197,11 @@ func (c *Client) getName() (string, error) {
}

func isCancelledError(err error) bool {
return err != nil && strings.Contains(err.Error(), "context canceled")
if err == nil {
return false
}

return strings.Contains(err.Error(), "context canceled") || strings.Contains(err.Error(), "the client connection is closing")
}

func (c *Client) reconnect() error {
Expand Down Expand Up @@ -248,7 +252,6 @@ func isConnectionError(err error) bool {
// From time to time, the server can start sending those errors to the
// agent. This mitigates the risk of an agent getting stuck in an error state
"unexpected HTTP status code received from server: 500",
"the client connection is closing",
}
for _, possibleErr := range possibleErrors {
if strings.Contains(err.Error(), possibleErr) {
Expand Down

0 comments on commit 26882e4

Please sign in to comment.