mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2025-12-19 08:41:24 +01:00
implement filter limit for timeline events on /sync
This commit is contained in:
parent
738acd2b35
commit
1114b66670
1 changed files with 5 additions and 1 deletions
|
|
@ -173,6 +173,7 @@ pub(crate) async fn sync_events_route(
|
||||||
lazy_load_enabled,
|
lazy_load_enabled,
|
||||||
lazy_load_send_redundant,
|
lazy_load_send_redundant,
|
||||||
full_state,
|
full_state,
|
||||||
|
&filter,
|
||||||
&compiled_filter,
|
&compiled_filter,
|
||||||
&mut device_list_updates,
|
&mut device_list_updates,
|
||||||
&mut left_encrypted_users,
|
&mut left_encrypted_users,
|
||||||
|
|
@ -402,6 +403,7 @@ async fn load_joined_room(
|
||||||
lazy_load_enabled: bool,
|
lazy_load_enabled: bool,
|
||||||
lazy_load_send_redundant: bool,
|
lazy_load_send_redundant: bool,
|
||||||
full_state: bool,
|
full_state: bool,
|
||||||
|
filter: &FilterDefinition,
|
||||||
compiled_filter: &CompiledFilterDefinition<'_>,
|
compiled_filter: &CompiledFilterDefinition<'_>,
|
||||||
device_list_updates: &mut HashSet<OwnedUserId>,
|
device_list_updates: &mut HashSet<OwnedUserId>,
|
||||||
left_encrypted_users: &mut HashSet<OwnedUserId>,
|
left_encrypted_users: &mut HashSet<OwnedUserId>,
|
||||||
|
|
@ -423,11 +425,13 @@ async fn load_joined_room(
|
||||||
drop(insert_lock);
|
drop(insert_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let timeline_limit =
|
||||||
|
filter.room.timeline.limit.map_or(10, u64::from).min(100);
|
||||||
let (timeline_pdus, oldest_timeline_event, limited) = load_timeline(
|
let (timeline_pdus, oldest_timeline_event, limited) = load_timeline(
|
||||||
sender_user,
|
sender_user,
|
||||||
room_id,
|
room_id,
|
||||||
sincecount,
|
sincecount,
|
||||||
10,
|
timeline_limit,
|
||||||
Some(compiled_filter),
|
Some(compiled_filter),
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue