mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2025-12-18 16:21:24 +01:00
MSC3575: avoid double-processing rooms in case of overlapping ranges
This commit is contained in:
parent
ede39370a4
commit
a72ff4f6e6
1 changed files with 12 additions and 11 deletions
|
|
@ -331,7 +331,7 @@ pub(crate) async fn sync_events_v4_route(
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut new_known_rooms = BTreeSet::new();
|
let mut list_room_ids = BTreeSet::new();
|
||||||
|
|
||||||
let mut ops = Vec::new();
|
let mut ops = Vec::new();
|
||||||
for (mut from, mut to) in list.ranges {
|
for (mut from, mut to) in list.ranges {
|
||||||
|
|
@ -348,15 +348,7 @@ pub(crate) async fn sync_events_v4_route(
|
||||||
..=to.try_into().unwrap_or(usize::MAX)]
|
..=to.try_into().unwrap_or(usize::MAX)]
|
||||||
.to_vec();
|
.to_vec();
|
||||||
|
|
||||||
new_known_rooms.extend(room_ids.iter().cloned());
|
list_room_ids.extend(room_ids.iter().cloned());
|
||||||
for room_id in &room_ids {
|
|
||||||
todo_rooms.entry(room_id.clone()).or_default().update(
|
|
||||||
list.room_details.required_state.clone(),
|
|
||||||
list.room_details.timeline_limit.unwrap_or(uint!(10)),
|
|
||||||
known_rooms.get(&list_id),
|
|
||||||
room_id,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
ops.push(sync_events::v4::SyncOp {
|
ops.push(sync_events::v4::SyncOp {
|
||||||
op: SlidingOp::Sync,
|
op: SlidingOp::Sync,
|
||||||
range: Some((from, to)),
|
range: Some((from, to)),
|
||||||
|
|
@ -366,6 +358,15 @@ pub(crate) async fn sync_events_v4_route(
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for room_id in &list_room_ids {
|
||||||
|
todo_rooms.entry(room_id.clone()).or_default().update(
|
||||||
|
list.room_details.required_state.clone(),
|
||||||
|
list.room_details.timeline_limit.unwrap_or(uint!(10)),
|
||||||
|
known_rooms.get(&list_id),
|
||||||
|
room_id,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
lists.insert(
|
lists.insert(
|
||||||
list_id.clone(),
|
list_id.clone(),
|
||||||
sync_events::v4::SyncList {
|
sync_events::v4::SyncList {
|
||||||
|
|
@ -378,7 +379,7 @@ pub(crate) async fn sync_events_v4_route(
|
||||||
services().users.update_sync_known_rooms(
|
services().users.update_sync_known_rooms(
|
||||||
connection_key.clone(),
|
connection_key.clone(),
|
||||||
list_id,
|
list_id,
|
||||||
new_known_rooms,
|
list_room_ids,
|
||||||
globalsince,
|
globalsince,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue