mirror of
https://gitlab.com/famedly/conduit.git
synced 2025-07-02 16:38:36 +00:00
allow for different timeframes for configuration
This commit is contained in:
parent
bdf12c2bbd
commit
024f910bf9
3 changed files with 32 additions and 7 deletions
|
@ -20,7 +20,10 @@ use axum_extra::{
|
|||
use bytes::{BufMut, BytesMut};
|
||||
use http::{Request, StatusCode};
|
||||
use ruma::{
|
||||
api::{client::error::ErrorKind, AuthScheme, IncomingRequest, OutgoingResponse},
|
||||
api::{
|
||||
client::error::{ErrorKind, RetryAfter},
|
||||
AuthScheme, IncomingRequest, OutgoingResponse,
|
||||
},
|
||||
server_util::authorization::XMatrix,
|
||||
CanonicalJsonValue, MilliSecondsSinceUnixEpoch, OwnedDeviceId, OwnedUserId, UserId,
|
||||
};
|
||||
|
@ -357,14 +360,16 @@ where
|
|||
}
|
||||
};
|
||||
|
||||
if let Err(retry_after_ms) = {
|
||||
if let Err(retry_after) = {
|
||||
services()
|
||||
.rate_limiting
|
||||
.update_or_reject(target, metadata)
|
||||
.map_err(Some)
|
||||
} {
|
||||
return Err(Error::BadRequest(
|
||||
ErrorKind::LimitExceeded { retry_after_ms },
|
||||
ErrorKind::LimitExceeded {
|
||||
retry_after: retry_after.map(|dur| RetryAfter::Delay(dur)),
|
||||
},
|
||||
"Rate limit exceeded.",
|
||||
));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue