feat(event cache): add a feature toggle to enable automatic back-pagination

This commit is contained in:
Benjamin Bouvier
2026-03-18 14:59:22 +01:00
parent 83c6a7fdf4
commit 9f18d76355
2 changed files with 15 additions and 0 deletions
+9
View File
@@ -2104,6 +2104,15 @@ impl Client {
}
}))))
}
/// Whether to enable automatic backpagination under certain conditions
/// (e.g. when processing read receipts).
///
/// This is an experimental feature, and might cause performance issues on
/// large accounts. Use with caution.
pub async fn enable_automatic_backpagination(&self) {
self.inner.event_cache().config_mut().await.experimental_auto_backpagination = true;
}
}
#[cfg(feature = "experimental-element-recent-emojis")]
+6
View File
@@ -379,6 +379,11 @@ pub struct EventCacheConfig {
/// Maximum number of pinned events to load, for any room.
pub max_pinned_events_to_load: usize,
/// Whether to automatically backpaginate a room under certain conditions.
///
/// Off by default.
pub experimental_auto_backpagination: bool,
}
impl EventCacheConfig {
@@ -395,6 +400,7 @@ impl Default for EventCacheConfig {
Self {
max_pinned_events_concurrent_requests: Self::DEFAULT_MAX_CONCURRENT_REQUESTS,
max_pinned_events_to_load: Self::DEFAULT_MAX_EVENTS_TO_LOAD,
experimental_auto_backpagination: false,
}
}
}