From 1afa8413a26e3f7ced6266565b756ab8065260b2 Mon Sep 17 00:00:00 2001 From: Ginger Date: Tue, 28 Oct 2025 09:15:49 -0400 Subject: [PATCH] feat: Add a config option to change the max TL size for legacy sync --- conduwuit-example.toml | 7 +++++++ src/api/client/sync/v3/joined.rs | 2 +- src/api/client/sync/v3/left.rs | 2 +- src/core/config/mod.rs | 12 ++++++++++++ 4 files changed, 21 insertions(+), 2 deletions(-) diff --git a/conduwuit-example.toml b/conduwuit-example.toml index aebe3be9..588c1f28 100644 --- a/conduwuit-example.toml +++ b/conduwuit-example.toml @@ -1196,6 +1196,13 @@ # #typing_client_timeout_max_s = 45 +# The maximum number of events to send at once for non-limited legacy syncs. +# Has no effect on sliding sync. This parameter also affects how many messages from each room +# are sent to the client on initial syncs, and larger values will make initial syncs slower. +# The default of 10 is reasonable for most use cases. +# +#incremental_sync_max_timeline_size = 10 + # Set this to true for continuwuity to compress HTTP response bodies using # zstd. This option does nothing if continuwuity was not built with # `zstd_compression` feature. Please be aware that enabling HTTP diff --git a/src/api/client/sync/v3/joined.rs b/src/api/client/sync/v3/joined.rs index 225e02a2..42ff2d5c 100644 --- a/src/api/client/sync/v3/joined.rs +++ b/src/api/client/sync/v3/joined.rs @@ -110,7 +110,7 @@ pub(super) async fn load_joined_room( room_id, previous_sync_end_count, Some(next_batchcount), - 10_usize, + services.config.incremental_sync_max_timeline_size, ); let receipt_events = services diff --git a/src/api/client/sync/v3/left.rs b/src/api/client/sync/v3/left.rs index 30986ab7..6ee754d3 100644 --- a/src/api/client/sync/v3/left.rs +++ b/src/api/client/sync/v3/left.rs @@ -146,7 +146,7 @@ pub(super) async fn load_left_room( room_id, Some(timeline_start_count), Some(timeline_end_count), - 10_usize, + services.config.incremental_sync_max_timeline_size, ) .await?; diff --git a/src/core/config/mod.rs b/src/core/config/mod.rs index fbb29357..18356490 100644 --- a/src/core/config/mod.rs +++ b/src/core/config/mod.rs @@ -1384,6 +1384,16 @@ pub struct Config { #[serde(default = "default_typing_client_timeout_max_s")] pub typing_client_timeout_max_s: u64, + /// The maximum number of events to send at once for non-limited legacy + /// syncs. Has no effect on sliding sync. This parameter also affects how + /// many messages from each room are sent to the client on initial syncs; + /// larger values will make initial syncs slower. The default of 10 is + /// reasonable for most use cases. + /// + /// default: 10 + #[serde(default = "default_incremental_sync_max_timeline_size")] + pub incremental_sync_max_timeline_size: usize, + /// Set this to true for continuwuity to compress HTTP response bodies using /// zstd. This option does nothing if continuwuity was not built with /// `zstd_compression` feature. Please be aware that enabling HTTP @@ -2449,6 +2459,8 @@ fn default_typing_client_timeout_min_s() -> u64 { 15 } fn default_typing_client_timeout_max_s() -> u64 { 45 } +fn default_incremental_sync_max_timeline_size() -> usize { 10 } + fn default_rocksdb_recovery_mode() -> u8 { 1 } fn default_rocksdb_log_level() -> String { "error".to_owned() }