This commit is contained in:
phiresky 2023-08-22 14:59:49 +00:00
parent 574e23cc61
commit eb761bbdcf
4 changed files with 9 additions and 8 deletions

View file

@ -3,15 +3,14 @@ use crate::{
schema::sent_activity, schema::sent_activity,
}; };
use diesel::{ use diesel::{
backend::Backend,
deserialize::FromSql, deserialize::FromSql,
pg::{Pg, PgValue}, pg::{Pg, PgValue},
serialize::{Output, ToSql}, serialize::{Output, ToSql},
sql_types::{Array, Jsonb, Nullable}, sql_types::{Jsonb, Nullable},
Queryable, Queryable,
}; };
use serde_json::Value; use serde_json::Value;
use std::{collections::HashSet, fmt::Debug, hash::Hash, io::Write}; use std::{collections::HashSet, fmt::Debug, io::Write};
use url::Url; use url::Url;
#[derive( #[derive(

View file

@ -149,9 +149,9 @@ async fn receive_print_stats(
async fn print_stats(pool: &mut DbPool<'_>, stats: &HashMap<String, FederationQueueState>) { async fn print_stats(pool: &mut DbPool<'_>, stats: &HashMap<String, FederationQueueState>) {
let last_id = crate::util::get_latest_activity_id(pool).await; let last_id = crate::util::get_latest_activity_id(pool).await;
let Ok(last_id) = last_id else { let Ok(last_id) = last_id else {
tracing::error!("could not get last id"); tracing::error!("could not get last id");
return; return;
}; };
// it's expected that the values are a bit out of date, everything < SAVE_STATE_EVERY should be considered up to date // it's expected that the values are a bit out of date, everything < SAVE_STATE_EVERY should be considered up to date
tracing::info!( tracing::info!(
"Federation state as of {}:", "Federation state as of {}:",

View file

@ -130,7 +130,9 @@ pub(crate) async fn get_activity_cached(
.await .await
.optional() .optional()
.context("could not read activity")?; .context("could not read activity")?;
let Some(mut row) = row else { return anyhow::Result::<_, anyhow::Error>::Ok(None) }; let Some(mut row) = row else {
return anyhow::Result::<_, anyhow::Error>::Ok(None);
};
// swap to avoid cloning // swap to avoid cloning
let mut data = Value::Null; let mut data = Value::Null;
std::mem::swap(&mut row.data, &mut data); std::mem::swap(&mut row.data, &mut data);

View file

@ -210,7 +210,7 @@ impl InstanceWorker {
activity activity
.send_inboxes .send_inboxes
.iter() .iter()
.filter_map(|e| e.as_ref()) .filter_map(std::option::Option::as_ref)
.filter_map(|u| (u.domain() == Some(&self.instance.domain)).then(|| u.inner().clone())), .filter_map(|u| (u.domain() == Some(&self.instance.domain)).then(|| u.inner().clone())),
); );
inbox_urls inbox_urls