Skip to content

Commit

Permalink
tsdbstore: Optimized response framing if iterator finished.
Browse files Browse the repository at this point in the history
Signed-off-by: Bartlomiej Plotka <[email protected]>
  • Loading branch information
bwplotka committed Aug 26, 2020
1 parent a6b1b6c commit 0a69bad
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pkg/store/tsdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,14 @@ func (s *TSDBStore) Series(r *storepb.SeriesRequest, srv storepb.Store_SeriesSer
if frameBytesLeft > 0 && isNext {
continue
}

if err := srv.Send(storepb.NewSeriesResponse(&storepb.Series{Labels: seriesLabels.Labels, Chunks: seriesChunks})); err != nil {
return status.Error(codes.Aborted, err.Error())
}
frameBytesLeft = bytesLeftForChunks
seriesChunks = make([]storepb.AggrChunk, 0, len(seriesChunks))

if isNext {
frameBytesLeft = bytesLeftForChunks
seriesChunks = make([]storepb.AggrChunk, 0, len(seriesChunks))
}
}
if err := chIter.Err(); err != nil {
return status.Error(codes.Internal, errors.Wrap(err, "chunk iter").Error())
Expand Down

0 comments on commit 0a69bad

Please sign in to comment.