Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make polling errors non-fatal #545

Merged
merged 1 commit into from
Apr 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions pkg/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -330,9 +330,9 @@ func (c *Client) StartPolling(duration time.Duration, callback InteractionCallba
err := c.getInteractions(callback)
if err != nil {
if errorutil.IsAny(err, authError) {
gologger.Fatal().Msgf("Could not authenticate to the server")
gologger.Error().Msgf("Could not authenticate to the server %v", err)
} else if errorutil.IsAny(err, storage.ErrCorrelationIdNotFound) {
gologger.Fatal().Msgf("The correlation id was not found (probably evicted due to inactivity)")
gologger.Error().Msgf("The correlation id was not found (probably evicted due to inactivity): %v", err)
}
}
case <-c.quitChan:
Expand Down Expand Up @@ -376,7 +376,10 @@ func (c *Client) getInteractions(callback InteractionCallback) error {
if resp.StatusCode == http.StatusUnauthorized {
return authError
}
data, _ := io.ReadAll(resp.Body)
data, err := io.ReadAll(resp.Body)
if err != nil {
return errors.Wrap(err, "could not read response body")
}
if stringsutil.ContainsAny(string(data), storage.ErrCorrelationIdNotFound.Error()) {
return storage.ErrCorrelationIdNotFound
}
Expand Down