diff --git a/src/service/federation/execute.rs b/src/service/federation/execute.rs index 7b074799b..b599154c6 100644 --- a/src/service/federation/execute.rs +++ b/src/service/federation/execute.rs @@ -1,4 +1,5 @@ use std::{ + any::TypeId, borrow::Cow, fmt::Debug, mem, @@ -125,6 +126,7 @@ impl super::Service { where T: OutgoingRequest = PathBuilderInput>> + Send, PathBuilderInput: FederationPathBuilderInput, + ::Authentication: 'static, { if !self.services.server.config.allow_federation { return Err!(Config("allow_federation", "Federation is disabled.")); @@ -136,7 +138,20 @@ impl super::Service { )))); } - self.ensure_remote_is_healthy(dest)?; + // Don't check health on unauthenticated requests, since those are only + // for keys and manual pings, which want to bypass health tracking + // anyway. + // + // TODO(nex): We should probably do a proper builder pattern for + // requests, since callers may wish to tune + // - Authentication (signed vs unsigned) + // - Health check activity + // - Timeout (normal vs slow) + // and having a billion functions and conditions for all of those is not + // ideal. + if TypeId::of::() != TypeId::of::() { + self.ensure_remote_is_healthy(dest)?; + } /// How long to wait with re-resolution if a server fails to resolve const UNRESOLVABLE_RETRY_AFTER: Duration = Duration::from_hours(24 * 90);