feat: Mark servers as online/offline based on transaction responses

This commit is contained in:
timedout authored and Ellis Git committed 2026-08-20 00:57:11 +00:00
1 parent 077338792f
commit 6ae66eed1b
2 files changed
+13 -1

No files matched your search

+2
View File
@@ -488,6 +488,8 @@ impl Service {
///
/// TODO: flush senders too
pub fn mark_healthy(&self, server_name: &ServerName) {
// TODO: We need to make sure the sender flush DOESN'T trigger if this is called
// by the senders themselves.
let mut map = self.remote_health.write();
map.remove(server_name);
}
+11 -1
View File
@@ -142,7 +142,14 @@ impl Service {
) {
match response {
| Ok(dest) => self.handle_response_ok(&dest, futures, statuses).await,
| Err((dest, e)) => Self::handle_response_err(dest, statuses, &e),
| Err((dest, e)) => {
if e.status_code().is_server_error()
&& let Destination::Federation(dest) = &dest
{
self.hit_unhealthy(dest.clone());
}
Self::handle_response_err(dest, statuses, &e);
},
}
}
@@ -171,6 +178,9 @@ impl Service {
) {
let _cork = self.db.db.cork();
self.db.delete_all_active_requests_for(dest).await;
if let Destination::Federation(server_name) = dest {
self.mark_healthy(server_name);
}
// Find events that have been added since starting the last request
let new_events = self