Skip to content

Commit

Permalink
No More Overshadowing Error
Browse files Browse the repository at this point in the history
When making the initial search, if an error was returned we put it in a variable with a limited, shadowing scope. By the time the function has returned, that error has gone out of scope and is not reported. This caused an empty result set to appear to not be an error.
  • Loading branch information
coreyogburn committed Jul 22, 2024
1 parent 4739d31 commit d6f800d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion server/modules/elastic/elasticeventstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,9 @@ func (store *ElasticEventstore) Scroll(ctx context.Context, criteria *model.Even
indexes = strings.Split(store.index, ",")
}

res, err := store.esClient.Search(
var res *esapi.Response

res, err = store.esClient.Search(
store.esClient.Search.WithContext(ctx),
store.esClient.Search.WithIndex(indexes...),
store.esClient.Search.WithBody(strings.NewReader(query)),
Expand Down

0 comments on commit d6f800d

Please sign in to comment.