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,
};
use diesel::{
backend::Backend,
deserialize::FromSql,
pg::{Pg, PgValue},
serialize::{Output, ToSql},
sql_types::{Array, Jsonb, Nullable},
sql_types::{Jsonb, Nullable},
Queryable,
};
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;
#[derive(

View file

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

View file

@ -130,7 +130,9 @@ pub(crate) async fn get_activity_cached(
.await
.optional()
.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
let mut data = Value::Null;
std::mem::swap(&mut row.data, &mut data);

View file

@ -210,7 +210,7 @@ impl InstanceWorker {
activity
.send_inboxes
.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())),
);
inbox_urls