From 3a7ce9aa95a256f9e35353ebc3f8c4fd00c00046 Mon Sep 17 00:00:00 2001 From: phiresky Date: Fri, 19 Jul 2024 15:41:06 +0200 Subject: [PATCH] make i32 and ugly casts --- crates/federate/src/worker.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/federate/src/worker.rs b/crates/federate/src/worker.rs index e2deac8c9..37d9a4e09 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: i64, + in_flight: i32, } 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 - || self.in_flight >= self.federation_worker_config.concurrent_sends_per_instance; + || self.in_flight as i64 >= 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 @@ -145,7 +145,7 @@ impl InstanceWorker { { // sanity check: calculate next id to send based on the last id and the in flight requests let expected_next_id = self.state.last_successful_id.map(|last_successful_id| { - last_successful_id.0 + (self.successfuls.len() as i64) + self.in_flight + 1 + last_successful_id.0 + (self.successfuls.len() as i64) + self.in_flight as i64 + 1 }); // compare to next id based on incrementing if expected_next_id != Some(next_id_to_send.0) {