Fix next_batch pagination tokens in relations response.
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
@@ -154,13 +154,11 @@ async fn paginate_relations_with_filter(
|
|||||||
.collect()
|
.collect()
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
let next_batch = match dir {
|
let next_batch = events
|
||||||
| Direction::Forward => events.last(),
|
.last()
|
||||||
| Direction::Backward => events.first(),
|
.map(at!(0))
|
||||||
}
|
.as_ref()
|
||||||
.map(at!(0))
|
.map(ToString::to_string);
|
||||||
.as_ref()
|
|
||||||
.map(ToString::to_string);
|
|
||||||
|
|
||||||
Ok(get_relating_events::v1::Response {
|
Ok(get_relating_events::v1::Response {
|
||||||
next_batch,
|
next_batch,
|
||||||
|
|||||||
@@ -92,8 +92,9 @@ impl Service {
|
|||||||
stack.push((relation.clone(), stack_pdu.1.saturating_add(1)));
|
stack.push((relation.clone(), stack_pdu.1.saturating_add(1)));
|
||||||
}
|
}
|
||||||
|
|
||||||
pdus.push(relation);
|
if pdus.len() < limit {
|
||||||
if pdus.len() >= limit {
|
pdus.push(relation);
|
||||||
|
} else {
|
||||||
break 'limit;
|
break 'limit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user