Skip to content

Commit

Permalink
check set key exist
Browse files Browse the repository at this point in the history
Signed-off-by: Ben Ye <yb532204897@gmail.com>
  • Loading branch information
yeya24 committed Oct 5, 2020
1 parent 86d1478 commit 00c67cf
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pkg/queryfrontend/metadata_codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ func (c metadataCodec) MergeResponse(responses ...queryrange.Response) (queryran

for _, res := range responses {
for _, value := range res.(*ThanosLabelsResponse).Data {
set[value] = struct{}{}
if _, ok := set[value]; !ok {
set[value] = struct{}{}
}
}
}
labels := make([]string, 0, len(set))
Expand All @@ -69,7 +71,8 @@ func (c metadataCodec) MergeResponse(responses ...queryrange.Response) (queryran

return &ThanosSeriesResponse{
Status: queryrange.StatusSuccess,
Data: metadataResponses[0].Data,
// TODO: fix this
Data: metadataResponses[0].Data,
}, nil
default:
return nil, httpgrpc.Errorf(http.StatusBadRequest, "invalid response format")
Expand Down

0 comments on commit 00c67cf

Please sign in to comment.