mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-26 14:21:19 +00:00
make i32 and ugly casts
This commit is contained in:
parent
20ab8e2c0e
commit
3a7ce9aa95
1 changed files with 3 additions and 3 deletions
|
@ -76,7 +76,7 @@ pub(crate) struct InstanceWorker {
|
||||||
// that are not the lowest number and thus can't be written to the database yet
|
// that are not the lowest number and thus can't be written to the database yet
|
||||||
successfuls: BinaryHeap<SendSuccessInfo>,
|
successfuls: BinaryHeap<SendSuccessInfo>,
|
||||||
// number of activities that currently have a task spawned to send it
|
// number of activities that currently have a task spawned to send it
|
||||||
in_flight: i64,
|
in_flight: i32,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl InstanceWorker {
|
impl InstanceWorker {
|
||||||
|
@ -127,7 +127,7 @@ impl InstanceWorker {
|
||||||
// too many in flight
|
// too many in flight
|
||||||
let need_wait_for_event = (self.in_flight != 0 && self.state.fail_count > 0)
|
let need_wait_for_event = (self.in_flight != 0 && self.state.fail_count > 0)
|
||||||
|| self.successfuls.len() >= MAX_SUCCESSFULS
|
|| 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 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
|
// 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
|
// 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| {
|
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
|
// compare to next id based on incrementing
|
||||||
if expected_next_id != Some(next_id_to_send.0) {
|
if expected_next_id != Some(next_id_to_send.0) {
|
||||||
|
|
Loading…
Reference in a new issue