Skip to content

Commit

Permalink
Do not deactive client on user error or timeout.
Browse files Browse the repository at this point in the history
  • Loading branch information
mcdee committed Jan 17, 2024
1 parent 6c557af commit 16ce83f
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions multi/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,19 @@ func (s *Service) doCall(ctx context.Context, call callFunc, errHandler errHandl
for _, client := range activeClients {
res, err = call(ctx, client)
if err != nil {
log.Trace().Err(err).Msg("Potentially deactivating client due to error")
var apiErr *api.Error
if errors.As(err, &apiErr) && apiErr.StatusCode/100 == 4 {
log.Trace().Str("client", client.Name()).Str("address", client.Address()).Err(err).Msg("Not deactivating client on user error")

return res, err
}
if errors.Is(err, context.Canceled) {
log.Trace().Str("client", client.Name()).Str("address", client.Address()).Msg("Not deactivating client on canceled context")

return res, err
}

failover := true
if errHandler != nil {
failover, err = errHandler(ctx, client, err)
Expand Down

0 comments on commit 16ce83f

Please sign in to comment.