mirror of
https://github.com/matrix-org/matrix-rust-sdk.git
synced 2026-05-05 14:35:20 -04:00
fix(ui): Update batch_size of all_rooms to 100.
This patch updates the `batch_size` of `all_rooms` once in growing
sync-mode to 100. It was previously increased from 50 to 200 in
12a1f25ec3. In some situations, it
generates very large payloads that can take time to be delivered to the
user with a slow network.
This patch tries to fine-tuned the `batch_size` value.
This commit is contained in:
@@ -133,7 +133,7 @@ struct SetAllRoomsListToGrowingSyncMode;
|
||||
|
||||
/// Default `batch_size` for the growing sync-mode of the `ALL_ROOMS_LIST_NAME`
|
||||
/// list.
|
||||
pub const ALL_ROOMS_DEFAULT_GROWING_BATCH_SIZE: u32 = 200;
|
||||
pub const ALL_ROOMS_DEFAULT_GROWING_BATCH_SIZE: u32 = 100;
|
||||
|
||||
#[async_trait]
|
||||
impl Action for SetAllRoomsListToGrowingSyncMode {
|
||||
@@ -385,7 +385,7 @@ mod tests {
|
||||
sliding_sync
|
||||
.on_list(ALL_ROOMS_LIST_NAME, |list| ready(matches!(
|
||||
list.sync_mode(),
|
||||
SlidingSyncMode::Growing { batch_size: 200, .. }
|
||||
SlidingSyncMode::Growing { batch_size: 100, .. }
|
||||
)))
|
||||
.await,
|
||||
Some(true)
|
||||
|
||||
@@ -297,7 +297,7 @@ async fn test_sync_all_states() -> Result<(), Error> {
|
||||
"conn_id": "room-list",
|
||||
"lists": {
|
||||
ALL_ROOMS: {
|
||||
"ranges": [[0, 199]],
|
||||
"ranges": [[0, 99]],
|
||||
},
|
||||
VISIBLE_ROOMS: {
|
||||
"ranges": [[0, 19]],
|
||||
@@ -367,7 +367,7 @@ async fn test_sync_all_states() -> Result<(), Error> {
|
||||
"conn_id": "room-list",
|
||||
"lists": {
|
||||
ALL_ROOMS: {
|
||||
"ranges": [[0, 399]],
|
||||
"ranges": [[0, 199]],
|
||||
},
|
||||
VISIBLE_ROOMS: {
|
||||
"ranges": [[0, 19]],
|
||||
@@ -408,7 +408,7 @@ async fn test_sync_all_states() -> Result<(), Error> {
|
||||
"conn_id": "room-list",
|
||||
"lists": {
|
||||
ALL_ROOMS: {
|
||||
"ranges": [[0, 599]],
|
||||
"ranges": [[0, 299]],
|
||||
},
|
||||
VISIBLE_ROOMS: {
|
||||
"ranges": [[0, 19]],
|
||||
@@ -449,7 +449,7 @@ async fn test_sync_all_states() -> Result<(), Error> {
|
||||
"conn_id": "room-list",
|
||||
"lists": {
|
||||
ALL_ROOMS: {
|
||||
"ranges": [[0, 799]],
|
||||
"ranges": [[0, 399]],
|
||||
},
|
||||
VISIBLE_ROOMS: {
|
||||
"ranges": [[0, 19]],
|
||||
@@ -654,7 +654,7 @@ async fn test_sync_resumes_from_error() -> Result<(), Error> {
|
||||
"pos": "1",
|
||||
"lists": {
|
||||
ALL_ROOMS: {
|
||||
"count": 410,
|
||||
"count": 210,
|
||||
},
|
||||
},
|
||||
"rooms": {},
|
||||
@@ -671,7 +671,7 @@ async fn test_sync_resumes_from_error() -> Result<(), Error> {
|
||||
ALL_ROOMS: {
|
||||
// In `SettingUp`, the sync-mode has changed to growing, with
|
||||
// its initial range.
|
||||
"ranges": [[0, 199]],
|
||||
"ranges": [[0, 99]],
|
||||
},
|
||||
VISIBLE_ROOMS: {
|
||||
// Hello new list.
|
||||
@@ -708,7 +708,7 @@ async fn test_sync_resumes_from_error() -> Result<(), Error> {
|
||||
ALL_ROOMS: {
|
||||
// In `Running`, the sync-mode is still growing, but the range
|
||||
// hasn't been modified due to previous error.
|
||||
"ranges": [[0, 199]],
|
||||
"ranges": [[0, 99]],
|
||||
},
|
||||
VISIBLE_ROOMS: {
|
||||
// We have set a viewport, which reflects here.
|
||||
@@ -724,7 +724,7 @@ async fn test_sync_resumes_from_error() -> Result<(), Error> {
|
||||
"pos": "2",
|
||||
"lists": {
|
||||
ALL_ROOMS: {
|
||||
"count": 410,
|
||||
"count": 210,
|
||||
},
|
||||
INVITES: {
|
||||
"count": 30,
|
||||
@@ -744,7 +744,7 @@ async fn test_sync_resumes_from_error() -> Result<(), Error> {
|
||||
ALL_ROOMS: {
|
||||
// In `Running`, the sync-mode is still growing, and the range
|
||||
// has made progress.
|
||||
"ranges": [[0, 399]],
|
||||
"ranges": [[0, 199]],
|
||||
},
|
||||
VISIBLE_ROOMS: {
|
||||
// Despites the error, the range is kept.
|
||||
@@ -777,7 +777,7 @@ async fn test_sync_resumes_from_error() -> Result<(), Error> {
|
||||
"lists": {
|
||||
ALL_ROOMS: {
|
||||
// Due to the error, the range is reset to its initial value.
|
||||
"ranges": [[0, 199]],
|
||||
"ranges": [[0, 99]],
|
||||
},
|
||||
VISIBLE_ROOMS: {
|
||||
// Despites the error, the range is kept.
|
||||
@@ -793,7 +793,7 @@ async fn test_sync_resumes_from_error() -> Result<(), Error> {
|
||||
"pos": "3",
|
||||
"lists": {
|
||||
ALL_ROOMS: {
|
||||
"count": 410,
|
||||
"count": 210,
|
||||
},
|
||||
INVITES: {
|
||||
"count": 4,
|
||||
@@ -812,7 +812,7 @@ async fn test_sync_resumes_from_error() -> Result<(), Error> {
|
||||
"lists": {
|
||||
ALL_ROOMS: {
|
||||
// No error. The range is making progress.
|
||||
"ranges": [[0, 399]],
|
||||
"ranges": [[0, 199]],
|
||||
},
|
||||
VISIBLE_ROOMS: {
|
||||
// No error. The range is still here.
|
||||
@@ -828,7 +828,7 @@ async fn test_sync_resumes_from_error() -> Result<(), Error> {
|
||||
"pos": "4",
|
||||
"lists": {
|
||||
ALL_ROOMS: {
|
||||
"count": 410,
|
||||
"count": 210,
|
||||
},
|
||||
},
|
||||
"rooms": {},
|
||||
@@ -845,7 +845,7 @@ async fn test_sync_resumes_from_error() -> Result<(), Error> {
|
||||
ALL_ROOMS: {
|
||||
// Range is making progress and is even reaching the maximum
|
||||
// number of rooms.
|
||||
"ranges": [[0, 409]],
|
||||
"ranges": [[0, 209]],
|
||||
},
|
||||
VISIBLE_ROOMS: {
|
||||
// The range is still here.
|
||||
@@ -880,7 +880,7 @@ async fn test_sync_resumes_from_error() -> Result<(), Error> {
|
||||
// An error was received at the previous sync iteration.
|
||||
// The list is still in growing sync-mode, but its range has
|
||||
// been reset.
|
||||
"ranges": [[0, 199]],
|
||||
"ranges": [[0, 99]],
|
||||
},
|
||||
VISIBLE_ROOMS: {
|
||||
// The range is still here.
|
||||
@@ -896,7 +896,7 @@ async fn test_sync_resumes_from_error() -> Result<(), Error> {
|
||||
"pos": "5",
|
||||
"lists": {
|
||||
ALL_ROOMS: {
|
||||
"count": 410,
|
||||
"count": 210,
|
||||
},
|
||||
},
|
||||
"rooms": {},
|
||||
@@ -957,7 +957,7 @@ async fn test_sync_resumes_from_terminated() -> Result<(), Error> {
|
||||
ALL_ROOMS: {
|
||||
// In `SettingUp`, the sync-mode has changed to growing, with
|
||||
// its initial range.
|
||||
"ranges": [[0, 199]],
|
||||
"ranges": [[0, 99]],
|
||||
},
|
||||
VISIBLE_ROOMS: {
|
||||
// Hello new list.
|
||||
@@ -1000,7 +1000,7 @@ async fn test_sync_resumes_from_terminated() -> Result<(), Error> {
|
||||
ALL_ROOMS: {
|
||||
// In `Running`, the sync-mode is still growing, the previous termination
|
||||
// didn't restart the whole growing.
|
||||
"ranges": [[0, 399]],
|
||||
"ranges": [[0, 199]],
|
||||
},
|
||||
VISIBLE_ROOMS: {
|
||||
// We have set a viewport, which reflects here.
|
||||
@@ -1043,7 +1043,7 @@ async fn test_sync_resumes_from_terminated() -> Result<(), Error> {
|
||||
ALL_ROOMS: {
|
||||
// In `Running`, the sync-mode is still growing, the previous termination
|
||||
// didn't restart the whole growing.
|
||||
"ranges": [[0, 599]],
|
||||
"ranges": [[0, 299]],
|
||||
},
|
||||
VISIBLE_ROOMS: {
|
||||
// Despites the termination, the range is kept.
|
||||
@@ -1078,7 +1078,7 @@ async fn test_sync_resumes_from_terminated() -> Result<(), Error> {
|
||||
"lists": {
|
||||
ALL_ROOMS: {
|
||||
// No termination.
|
||||
"ranges": [[0, 799]],
|
||||
"ranges": [[0, 399]],
|
||||
},
|
||||
VISIBLE_ROOMS: {
|
||||
// No termination. The range is still here.
|
||||
@@ -1118,7 +1118,7 @@ async fn test_sync_resumes_from_terminated() -> Result<(), Error> {
|
||||
ALL_ROOMS: {
|
||||
// The termination doesn't invalidate the range, we're still in the stable
|
||||
// state.
|
||||
"ranges": [[0, 999]],
|
||||
"ranges": [[0, 499]],
|
||||
},
|
||||
VISIBLE_ROOMS: {
|
||||
// The range is still here.
|
||||
@@ -2388,7 +2388,7 @@ async fn test_input_viewport() -> Result<(), Error> {
|
||||
assert request >= {
|
||||
"lists": {
|
||||
ALL_ROOMS: {
|
||||
"ranges": [[0, 199]],
|
||||
"ranges": [[0, 99]],
|
||||
},
|
||||
VISIBLE_ROOMS: {
|
||||
"ranges": [[0, 19]],
|
||||
@@ -2425,7 +2425,7 @@ async fn test_input_viewport() -> Result<(), Error> {
|
||||
assert request >= {
|
||||
"lists": {
|
||||
ALL_ROOMS: {
|
||||
"ranges": [[0, 199]],
|
||||
"ranges": [[0, 99]],
|
||||
},
|
||||
VISIBLE_ROOMS: {
|
||||
"ranges": [[10, 15], [20, 25]],
|
||||
|
||||
Reference in New Issue
Block a user