Commit 6e080a7c35
Unsigned
Layout: unified · split
src/room/mod.rs +7 −5
| @@ -143,7 +143,10 @@ const HISTORY_PAGE_TAGS: [&str; 2] = | ||
| 143 | 143 | ["matrix_history_page", "matrix_smart_filter"]; |
| 144 | 144 | const RESTORED_HISTORY_BATCH_SIZE: u16 = 25; |
| 145 | 145 | const INTERACTIVE_HISTORY_BATCH_SIZE: u16 = 25; |
| 146 | const RESTORED_HISTORY_TARGET_LINES: i32 = 100; | |
| 146 | // Restore one current page eagerly. Further pages are user-driven so a noisy | |
| 147 | // room cannot monopolize its history lock while the GUI is asking for older | |
| 148 | // messages in the room the user is actually viewing. | |
| 149 | const RESTORED_HISTORY_TARGET_LINES: i32 = 1; | |
| 147 | 150 | const RESTORED_HISTORY_MAX_PAGES: usize = 10; |
| 148 | 151 | |
| 149 | 152 | fn restored_prev_batch(_prev_batch: Option<String>) -> Option<PrevBatch> { |
| @@ -3278,10 +3281,9 @@ mod tests { | ||
| 3278 | 3281 | } |
| 3279 | 3282 | |
| 3280 | 3283 | #[test] |
| 3281 | fn restored_history_keeps_paging_until_it_is_useful() { | |
| 3282 | assert!(should_continue_restored_history(0, 13, true)); | |
| 3283 | assert!(should_continue_restored_history(87, 99, true)); | |
| 3284 | assert!(!should_continue_restored_history(99, 112, true)); | |
| 3284 | fn restored_history_releases_the_lock_after_one_useful_page() { | |
| 3285 | assert!(!should_continue_restored_history(0, 13, true)); | |
| 3286 | assert!(!should_continue_restored_history(87, 99, true)); | |
| 3285 | 3287 | assert!(!should_continue_restored_history(13, 13, true)); |
| 3286 | 3288 | assert!(!should_continue_restored_history(0, 13, false)); |
| 3287 | 3289 | } |