add log_errors parameter to send_federation_request builder

This allows us to use send_federation_request for federation
transactions.
This commit is contained in:
Olivia Lee 2024-08-23 20:15:28 -07:00
parent 10d361e347
commit 3f82676a81
No known key found for this signature in database
GPG key ID: 54D568A15B9CD1F9

View file

@ -122,6 +122,7 @@ pub(crate) struct RequestData {
pub(crate) struct SendFederationRequestBuilder<'a, T> {
destination: &'a ServerName,
request: T,
log_errors: LogRequestError,
}
pub(crate) struct Service {
@ -686,6 +687,7 @@ impl Service {
SendFederationRequestBuilder {
destination,
request,
log_errors: LogRequestError::Yes,
}
}
@ -714,6 +716,17 @@ impl Service {
}
}
impl<T> SendFederationRequestBuilder<'_, T> {
/// Enable or disable automatically logging any error making this request.
///
/// This should be disabled if the error is going to be logged elsewhere,
/// to avoid cluttering logs with duplicate error messages.
pub(crate) fn log_errors(mut self, log_errors: LogRequestError) -> Self {
self.log_errors = log_errors;
self
}
}
impl<'a, T> IntoFuture for SendFederationRequestBuilder<'a, T>
where
T: OutgoingRequest + Send + Debug + 'a,
@ -743,7 +756,7 @@ where
server_server::send_request(
self.destination,
self.request,
LogRequestError::Yes,
self.log_errors,
AllowLoopbackRequests::No,
),
)