From 0297cfe30720362a470a5d1a2cf96fae2ee55c1d Mon Sep 17 00:00:00 2001 From: strawberry Date: Sun, 14 Jan 2024 00:52:34 -0500 Subject: [PATCH] remove cached destination for a destination if request fails this can help if users change their well-known or such and we don't want to keep on hitting the old destination. from https://gitlab.com/Aranjedeath/conduit/-/commit/11357d1f1af27b0cbd06ee2d8431bd965bc6d95e Co-authored-by: Jacob Taylor Signed-off-by: strawberry --- src/api/server_server.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/api/server_server.rs b/src/api/server_server.rs index 1a203f7d..cbd511b7 100644 --- a/src/api/server_server.rs +++ b/src/api/server_server.rs @@ -308,6 +308,18 @@ where }) } else { debug!("Returning error from {destination}"); + + // remove potentially dead destinations from our cache that may be from modified well-knowns + if !write_destination_to_cache { + info!("Evicting {destination} from our true destination cache due to failed request."); + services() + .globals + .actual_destination_cache + .write() + .unwrap() + .remove(destination); + } + Err(Error::FederationError( destination.to_owned(), RumaError::from_http_response(http_response),