Skip to content

Commit

Permalink
client: auto-reconnect for 500 errors (#743)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fizzadar authored Feb 6, 2025
1 parent e43fe38 commit 495e4eb
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions connectionevents.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,12 @@ func (cli *Client) handleConnectFailure(node *waBinary.Node) {
// By default, expect a disconnect (i.e. prevent auto-reconnect)
cli.expectDisconnect()
willAutoReconnect = false
case reason == events.ConnectFailureServiceUnavailable:
case reason == events.ConnectFailureServiceUnavailable || reason == events.ConnectFailureInternalServerError:
// Auto-reconnect for 503s
case reason == events.ConnectFailureCATInvalid || reason == events.ConnectFailureCATExpired:
// Auto-reconnect when rotating CAT, lock socket to ensure refresh goes through before reconnect
cli.socketLock.RLock()
defer cli.socketLock.RUnlock()
case reason == 500 && message == "biz vname fetch error":
// These happen for business accounts randomly, also auto-reconnect
}
if reason == 403 {
cli.Log.Debugf(
Expand Down

0 comments on commit 495e4eb

Please sign in to comment.