mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-12-04 14:21:50 +00:00
fix: Don't check health for unsigned requests
This commit is contained in:
1 file changed
+16
-1
@@ -1,4 +1,5 @@
|
||||
use std::{
|
||||
any::TypeId,
|
||||
borrow::Cow,
|
||||
fmt::Debug,
|
||||
mem,
|
||||
@@ -125,6 +126,7 @@ impl super::Service {
|
||||
where
|
||||
T: OutgoingRequest<PathBuilder: PathBuilder<Input<'i> = PathBuilderInput>> + Send,
|
||||
PathBuilderInput: FederationPathBuilderInput,
|
||||
<T as ruma::api::Metadata>::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::<T::Authentication>() != TypeId::of::<NoAuthentication>() {
|
||||
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);
|
||||
|
||||
Reference in new issue
Block a user