make next_batch token a variable in search, revert threads_until change

Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
strawberry 2024-05-06 02:40:16 -04:00 committed by June
parent 1f8a7a707c
commit 7b25ef2e6c
2 changed files with 5 additions and 3 deletions

View file

@ -118,7 +118,9 @@ pub(crate) async fn search_events_route(body: Ruma<search_events::v3::Request>)
};
let mut results = Vec::new();
for _ in 0_usize..skip.saturating_add(limit) {
let next_batch: usize = skip.saturating_add(limit);
for _ in 0..next_batch {
if let Some(s) = searches
.iter_mut()
.map(|s| (s.peek().cloned(), s))
@ -167,7 +169,7 @@ pub(crate) async fn search_events_route(body: Ruma<search_events::v3::Request>)
let next_batch = if results.len() < limit {
None
} else {
Some((skip.checked_add(limit).unwrap()).to_string())
Some(next_batch.to_string())
};
Ok(search_events::v3::Response::new(ResultCategories {

View file

@ -19,7 +19,7 @@ impl service::rooms::threads::Data for KeyValueDatabase {
.to_vec();
let mut current = prefix.clone();
current.extend_from_slice(&(until.saturating_sub(1)).to_be_bytes());
current.extend_from_slice(&(until - 1).to_be_bytes());
Ok(Box::new(
self.threadid_userids