make i32 and ugly casts

This commit is contained in:
phiresky 2024-07-19 15:41:06 +02:00
parent 20ab8e2c0e
commit 3a7ce9aa95

View file

@ -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: 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) {