Add upper-bound to readreceipts_since() and callsites.

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk
2025-07-26 04:44:09 +00:00
parent 33a9fce828
commit c6836e51b2
7 changed files with 19 additions and 15 deletions

View File

@@ -536,17 +536,15 @@ impl Service {
max_edu_count: &AtomicU64,
num: &AtomicUsize,
) -> ReceiptMap {
let receipts = self
.services
.read_receipt
.readreceipts_since(room_id, since.0);
let receipts =
self.services
.read_receipt
.readreceipts_since(room_id, since.0, Some(since.1));
pin_mut!(receipts);
let mut read = BTreeMap::<OwnedUserId, ReceiptData>::new();
while let Some((user_id, count, read_receipt)) = receipts.next().await {
if count > since.1 {
break;
}
debug_assert!(count <= since.1, "exceeds upper-bound");
max_edu_count.fetch_max(count, Ordering::Relaxed);
if !self.services.globals.user_is_local(user_id) {