From 7458b0953288c4701de06762aefe6742e7c75a30 Mon Sep 17 00:00:00 2001 From: Nutomic Date: Mon, 22 Jul 2024 15:58:50 +0200 Subject: [PATCH] Change type of concurrent sends in config (#4914) --- Cargo.lock | 1 + crates/federate/src/worker.rs | 4 ++-- crates/utils/src/settings/structs.rs | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2b44775af..4f8f5992b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3208,6 +3208,7 @@ dependencies = [ "reqwest 0.11.27", "reqwest-middleware 0.2.5", "reqwest-tracing 0.4.8", + "rustls 0.23.10", "serde_json", "serial_test", "tokio", diff --git a/crates/federate/src/worker.rs b/crates/federate/src/worker.rs index 28f21dcc2..f6e70d846 100644 --- a/crates/federate/src/worker.rs +++ b/crates/federate/src/worker.rs @@ -76,7 +76,7 @@ pub(crate) struct InstanceWorker { // that are not the lowest number and thus can't be written to the database yet successfuls: BinaryHeap, // number of activities that currently have a task spawned to send it - in_flight: i32, + in_flight: i8, } impl InstanceWorker { @@ -127,7 +127,7 @@ impl InstanceWorker { // too many in flight let need_wait_for_event = (self.in_flight != 0 && self.state.fail_count > 0) || self.successfuls.len() >= MAX_SUCCESSFULS - || i64::from(self.in_flight) >= self.federation_worker_config.concurrent_sends_per_instance; + || self.in_flight >= self.federation_worker_config.concurrent_sends_per_instance; if need_wait_for_event || self.receive_send_result.len() > MIN_ACTIVITY_SEND_RESULTS_TO_HANDLE { // if len() > 0 then this does not block and allows us to write to db more often diff --git a/crates/utils/src/settings/structs.rs b/crates/utils/src/settings/structs.rs index dcacc37b6..547ae20d9 100644 --- a/crates/utils/src/settings/structs.rs +++ b/crates/utils/src/settings/structs.rs @@ -242,5 +242,5 @@ pub struct FederationWorkerConfig { /// Set this to a higher value than 1 (e.g. 6) only if you have a huge instance (>10 activities /// per second) and if a receiving instance is not keeping up. #[default(1)] - pub concurrent_sends_per_instance: i64, + pub concurrent_sends_per_instance: i8, }