feat: 410 Gone Handling

This commit is contained in:
Jacob Taylor committed 2026-11-11 13:52:27 -08:00
1 parent 67f31756b9
commit b2d5aa8625
4 files changed
+30 -15

No files matched your search

+16 -3
View File
@@ -1,4 +1,9 @@
use std::{borrow::Cow, fmt::Debug, mem, time::Instant};
use std::{
borrow::Cow,
fmt::Debug,
mem,
time::{Duration, Instant},
};
use conduwuit::{
Err, Error, Result, debug, debug_error, debug_info, debug_warn, err, metrics::KeyValue,
@@ -133,12 +138,20 @@ impl super::Service {
self.ensure_remote_is_healthy(dest)?;
/// How long to mark a server as unhealthy before attempting
/// re-resolution
const UNHEALTHY_TIMEOUT: Duration = Duration::from_hours(24 * 90);
let actual = self
.services
.client
.matrix_resolver
.resolve_server(dest.as_str())
.await?;
.await
.inspect_err(|_| {
self.hit_unhealthy(dest.to_owned(), Some(UNHEALTHY_TIMEOUT));
self.mark_destination_stale(dest);
})?;
let request = Request::try_from(request.try_into_http_request::<Vec<u8>>(
actual.base_url().as_str(),
@@ -210,7 +223,7 @@ impl super::Service {
if self.should_mark_stale(&wrapped) {
debug_info!("{dest} is unhealthy & stale due to a connect error");
self.mark_destination_stale(dest);
self.hit_unhealthy(dest.to_owned());
self.hit_unhealthy(dest.to_owned(), None);
}
let Error::Reqwest(unwrapped) = wrapped else {
unreachable!("wrapped reqwest error must unwrap to a reqwest error");