feat: Make max_active_txns actually configurable

This commit is contained in:
nexy7574
2026-02-21 15:15:26 +00:00
committed by timedout
parent fcd49b7ab3
commit dd70094719
4 changed files with 24 additions and 6 deletions
+9
View File
@@ -290,6 +290,15 @@
#
#max_fetch_prev_events = 192
# How many incoming federation transactions the server is willing to be
# processing at any given time before it becomes overloaded and starts
# rejecting further transactions until some slots become available.
#
# Setting this value too low or too high may result in unstable
# federation, and setting it too high may cause runaway resource usage.
#
#max_concurrent_inbound_transactions = 150
# Default/base connection timeout (seconds). This is used only by URL
# previews and update/news endpoint checks.
#
+1 -5
View File
@@ -151,11 +151,7 @@ async fn process_inbound_transaction(
.filter_map(Result::ok)
.stream();
info!(
pdus = body.pdus.len(),
edus = body.edus.len(),
"Processing transaction",
);
info!(pdus = body.pdus.len(), edus = body.edus.len(), "Processing transaction",);
let Ok(results) = handle(&services, &client, body.origin(), txn_start_time, pdus, edus).await
else {
// TODO: handle this properly. The channel doesn't like being closed with no
+13
View File
@@ -368,6 +368,17 @@ pub struct Config {
#[serde(default = "default_max_fetch_prev_events")]
pub max_fetch_prev_events: u16,
/// How many incoming federation transactions the server is willing to be
/// processing at any given time before it becomes overloaded and starts
/// rejecting further transactions until some slots become available.
///
/// Setting this value too low or too high may result in unstable
/// federation, and setting it too high may cause runaway resource usage.
///
/// default: 150
#[serde(default = "default_max_concurrent_inbound_transactions")]
pub max_concurrent_inbound_transactions: usize,
/// Default/base connection timeout (seconds). This is used only by URL
/// previews and update/news endpoint checks.
///
@@ -2540,6 +2551,8 @@ fn default_pusher_idle_timeout() -> u64 { 15 }
fn default_max_fetch_prev_events() -> u16 { 192_u16 }
fn default_max_concurrent_inbound_transactions() -> usize { 150 }
fn default_tracing_flame_filter() -> String {
cfg!(debug_assertions)
.then_some("trace,h2=off")
+1 -1
View File
@@ -37,7 +37,7 @@ impl crate::Service for Service {
},
servername_txnid_response_cache: Arc::new(SyncRwLock::new(HashMap::new())),
servername_txnid_active: Arc::new(SyncRwLock::new(HashMap::new())),
max_active_txns: 50, // TODO: fetch from config
max_active_txns: args.depend::<crate::config::Service>("config").max_concurrent_inbound_transactions
}))
}