mirror of
https://forgejo.ellis.link/continuwuation/continuwuity/
synced 2026-08-22 12:09:52 +00:00
fix: Mark even more error codes as stale based on observed data
This commit is contained in:
@@ -184,7 +184,15 @@ pub fn should_mark_stale(&self, error: &Error) -> bool {
|
||||
}
|
||||
}
|
||||
|
||||
error.status_code() == StatusCode::MISDIRECTED_REQUEST
|
||||
match error.status_code() {
|
||||
// Some special servers account for this specifically
|
||||
| StatusCode::MISDIRECTED_REQUEST
|
||||
// Common error codes observed for misdirected requests
|
||||
// | StatusCode::NOT_FOUND This one can be encountered naturally
|
||||
| StatusCode::METHOD_NOT_ALLOWED
|
||||
| StatusCode::IM_A_TEAPOT => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns a clone of the internal remote health tracking map.
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
join, pin_mut,
|
||||
stream::FuturesUnordered,
|
||||
};
|
||||
use http::StatusCode;
|
||||
use ruma::{
|
||||
CanonicalJsonObject, MilliSecondsSinceUnixEpoch, OwnedRoomId, OwnedServerName, OwnedUserId,
|
||||
RoomId, ServerName, UInt,
|
||||
@@ -145,7 +146,9 @@ async fn handle_response<'a>(
|
||||
| Ok(dest) => self.handle_response_ok(&dest, futures, statuses).await,
|
||||
| Err((dest, e)) => {
|
||||
if let Destination::Federation(dest) = &dest {
|
||||
if self.services.federation.should_mark_stale(&e) {
|
||||
if self.services.federation.should_mark_stale(&e)
|
||||
|| e.status_code() == StatusCode::NOT_FOUND
|
||||
{
|
||||
debug!("{dest} is now unhealthy & stale due to a connect error: {e:?}");
|
||||
self.services.federation.mark_destination_stale(dest);
|
||||
self.services.federation.hit_unhealthy(dest.clone());
|
||||
|
||||
Reference in New Issue
Block a user