feat: Make max_active_txns actually configurable

This commit is contained in:
nexy7574 authored and timedout committed 2026-02-23 16:36:45 +00:00
1 parent fcd49b7ab3
commit dd70094719
4 files changed
+24 -6

No files matched your search

+9
View File
@@ -290,6 +290,15 @@
# #
#max_fetch_prev_events = 192 #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 # Default/base connection timeout (seconds). This is used only by URL
# previews and update/news endpoint checks. # previews and update/news endpoint checks.
# #
+1 -5
View File
@@ -151,11 +151,7 @@ async fn process_inbound_transaction(
.filter_map(Result::ok) .filter_map(Result::ok)
.stream(); .stream();
info!( info!(pdus = body.pdus.len(), edus = body.edus.len(), "Processing transaction",);
pdus = body.pdus.len(),
edus = body.edus.len(),
"Processing transaction",
);
let Ok(results) = handle(&services, &client, body.origin(), txn_start_time, pdus, edus).await let Ok(results) = handle(&services, &client, body.origin(), txn_start_time, pdus, edus).await
else { else {
// TODO: handle this properly. The channel doesn't like being closed with no // 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")] #[serde(default = "default_max_fetch_prev_events")]
pub max_fetch_prev_events: u16, 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 /// Default/base connection timeout (seconds). This is used only by URL
/// previews and update/news endpoint checks. /// 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_fetch_prev_events() -> u16 { 192_u16 }
fn default_max_concurrent_inbound_transactions() -> usize { 150 }
fn default_tracing_flame_filter() -> String { fn default_tracing_flame_filter() -> String {
cfg!(debug_assertions) cfg!(debug_assertions)
.then_some("trace,h2=off") .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_response_cache: Arc::new(SyncRwLock::new(HashMap::new())),
servername_txnid_active: 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
})) }))
} }