Skip to content

Commit

Permalink
Fix CachingProxyNodeClient::last_segment_headers()
Browse files Browse the repository at this point in the history
  • Loading branch information
nazar-pc committed Jul 25, 2024
1 parent be519f0 commit 7f177f7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -199,11 +199,10 @@ where
match internal_result {
Ok(segment_headers) => segment_headers
.into_iter()
.map(|maybe_segment_header| {
.inspect(|maybe_segment_header| {
if maybe_segment_header.is_none() {
error!("Received empty optional segment header!");
}
maybe_segment_header
})
.collect::<Option<Vec<_>>>()
.map(|segment_headers| SegmentHeaderResponse { segment_headers }),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ impl SegmentHeaders {
.copied()
.rev()
.take(limit as usize)
.rev()
.map(Some)
.collect()
}
Expand Down Expand Up @@ -88,10 +87,7 @@ impl SegmentHeaders {
break 'outer;
};

if self.segment_headers.len() == u64::from(segment_header.segment_index()) as usize
{
self.segment_headers.push(segment_header);
}
self.push(segment_header);
}

segment_index_offset += segment_index_step;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ pub enum SegmentHeaderRequest {
/// Segment indexes to get.
segment_indexes: Vec<SegmentIndex>,
},
/// Defines how many segment headers to return.
// TODO: Should this be changed to return segments in normal order once we can introduce
// breaking changes?
/// Defines how many segment headers to return, segments will be in reverse order.
LastSegmentHeaders {
/// Number of segment headers to return.
// TODO: Replace u64 with a smaller type when able to make breaking changes
Expand Down

0 comments on commit 7f177f7

Please sign in to comment.