remove crashable, comment

federation-send-parallel
phiresky 2024-05-30 13:18:36 +02:00
parent 175133f0cd
commit 2acdc78d81
2 changed files with 8 additions and 8 deletions

View File

@ -92,6 +92,10 @@ impl CommunityInboxCollector {
.send_inboxes .send_inboxes
.iter() .iter()
.filter_map(std::option::Option::as_ref) .filter_map(std::option::Option::as_ref)
// a similar filter also happens within the activitypub-federation crate. but that filter
// happens much later - by doing it here, we can ensure that in the happy case, this
// function returns 0 urls which means the system doesn't have to create a tokio
// task for sending at all (since that task has a fair amount of overhead)
.filter(|&u| (u.domain() == Some(&self.domain))) .filter(|&u| (u.domain() == Some(&self.domain)))
.map(|u| u.inner().clone()), .map(|u| u.inner().clone()),
); );

View File

@ -8,9 +8,7 @@ use crate::{
WORK_FINISHED_RECHECK_DELAY, WORK_FINISHED_RECHECK_DELAY,
}, },
}; };
use activitypub_federation::{ use activitypub_federation::config::FederationConfig;
config::{FederationConfig},
};
use anyhow::{Context, Result}; use anyhow::{Context, Result};
use chrono::{DateTime, Days, TimeZone, Utc}; use chrono::{DateTime, Days, TimeZone, Utc};
use lemmy_api_common::{ use lemmy_api_common::{
@ -119,11 +117,9 @@ impl InstanceWorker {
let next_id_to_send = ActivityId(last_sent_id.0 + 1); let next_id_to_send = ActivityId(last_sent_id.0 + 1);
{ {
// 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 last_successful_id = self let last_successful_id = self.state.last_successful_id.map(|e| e.0).context(
.state "impossible: id is initialized in get_latest_ids and never returned to None",
.last_successful_id )?;
.map(|e| e.0)
.expect("set above");
let expected_next_id = last_successful_id + (successfuls.len() as i64) + in_flight + 1; let expected_next_id = last_successful_id + (successfuls.len() as i64) + in_flight + 1;
// compare to next id based on incrementing // compare to next id based on incrementing
if expected_next_id != next_id_to_send.0 { if expected_next_id != next_id_to_send.0 {