Skip to content

Commit

Permalink
Change type of concurrent sends in config (#4914)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nutomic committed Jul 23, 2024
1 parent 9dc4de3 commit 7458b09
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions crates/federate/src/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<SendSuccessInfo>,
// number of activities that currently have a task spawned to send it
in_flight: i32,
in_flight: i8,
}

impl InstanceWorker {
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion crates/utils/src/settings/structs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}

0 comments on commit 7458b09

Please sign in to comment.