X-Git-Url: http://these/git/?a=blobdiff_plain;f=crates%2Fapub%2Fsrc%2Ffetcher%2Fwebfinger.rs;h=0dfdfc2227accebb9e57e8a96efe9725b7b0ba58;hb=235cc8b22897bfb3e71ba3dbd725d36863fea8ba;hp=428c8d59a41c8ebffb40b722a989180f8638f3ca;hpb=276a8c2bd3e4fd1323e66b808675cf14cf6f75c5;p=lemmy.git diff --git a/crates/apub/src/fetcher/webfinger.rs b/crates/apub/src/fetcher/webfinger.rs index 428c8d59..0dfdfc22 100644 --- a/crates/apub/src/fetcher/webfinger.rs +++ b/crates/apub/src/fetcher/webfinger.rs @@ -2,7 +2,8 @@ use crate::{local_instance, ActorType}; use activitypub_federation::{core::object_id::ObjectId, traits::ApubObject}; use anyhow::anyhow; use itertools::Itertools; -use lemmy_db_schema::newtypes::DbUrl; +use lemmy_api_common::utils::blocking; +use lemmy_db_schema::{newtypes::DbUrl, source::local_site::LocalSite}; use lemmy_utils::error::LemmyError; use lemmy_websocket::LemmyContext; use serde::{Deserialize, Serialize}; @@ -47,8 +48,14 @@ where ); debug!("Fetching webfinger url: {}", &fetch_url); + let local_site = blocking(context.pool(), LocalSite::read).await?; + let http_fetch_retry_limit = local_site + .as_ref() + .map(|l| l.federation_http_fetch_retry_limit) + .unwrap_or(25); + *request_counter += 1; - if *request_counter > context.settings().federation.http_fetch_retry_limit { + if *request_counter > http_fetch_retry_limit { return Err(LemmyError::from_message("Request retry limit reached")); }