mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2025-12-17 15:51:23 +01:00
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:
parent
10d361e347
commit
3f82676a81
1 changed files with 14 additions and 1 deletions
|
|
@ -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,
|
||||
),
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue