Don't check rate limit twice.

rate_limit_ws_joins
Dessalines 2022-03-28 14:21:02 -04:00 committed by Nutomic
parent 66bfb2b525
commit 1ae4fe20bd
1 changed files with 2 additions and 2 deletions

View File

@ -485,7 +485,7 @@ impl ChatServer {
UserOperationCrud::CreatePost => rate_limiter.post().check(ip), UserOperationCrud::CreatePost => rate_limiter.post().check(ip),
UserOperationCrud::CreateCommunity => rate_limiter.register().check(ip), UserOperationCrud::CreateCommunity => rate_limiter.register().check(ip),
UserOperationCrud::CreateComment => rate_limiter.comment().check(ip), UserOperationCrud::CreateComment => rate_limiter.comment().check(ip),
_ => rate_limiter.message().check(ip), _ => true,
}; };
let fut = (message_handler_crud)(context, msg.id, user_operation_crud, data); let fut = (message_handler_crud)(context, msg.id, user_operation_crud, data);
(passed, fut) (passed, fut)
@ -493,7 +493,7 @@ impl ChatServer {
let user_operation = UserOperation::from_str(op)?; let user_operation = UserOperation::from_str(op)?;
let passed = match user_operation { let passed = match user_operation {
UserOperation::GetCaptcha => rate_limiter.post().check(ip), UserOperation::GetCaptcha => rate_limiter.post().check(ip),
_ => rate_limiter.message().check(ip), _ => true,
}; };
let fut = (message_handler)(context, msg.id, user_operation, data); let fut = (message_handler)(context, msg.id, user_operation, data);
(passed, fut) (passed, fut)