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 11357d1f1a

Co-authored-by: Jacob Taylor <jacob@explodie.org>
Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
strawberry 2024-01-14 00:52:34 -05:00 committed by June
parent ad792f4565
commit 0297cfe307

View file

@ -308,6 +308,18 @@ where
}) })
} else { } else {
debug!("Returning error from {destination}"); 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( Err(Error::FederationError(
destination.to_owned(), destination.to_owned(),
RumaError::from_http_response(http_response), RumaError::from_http_response(http_response),