Skip to content

Commit

Permalink
do not retry when there is malformed data
Browse files Browse the repository at this point in the history
  • Loading branch information
devcorpio committed Feb 22, 2024
1 parent 627bde3 commit abeeb33
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion heartbeat/monitors/wrappers/monitorstate/esloader.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ func MakeESLoader(esc *eslegclient.Connection, indexPattern string, beatLocation
err = json.Unmarshal(body, &sh)
if err != nil {
sErr := fmt.Errorf("could not unmarshal state hits for %s: %w", sf.ID, err)
return nil, LoaderError{err: sErr, Retry: true}
return nil, LoaderError{err: sErr, Retry: false}
}

if len(sh.Hits.Hits) == 0 {
Expand Down
5 changes: 5 additions & 0 deletions heartbeat/monitors/wrappers/monitorstate/esloader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,11 @@ func TestMakeESLoaderError(t *testing.T) {
statusCode: http.StatusNotFound,
expected: false,
},
{
name: "should not return a retryable error when handling malformed data",
statusCode: http.StatusOK,
expected: false,
},
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
Expand Down

0 comments on commit abeeb33

Please sign in to comment.