Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Don't process /send requests for users who have hit their ratelimit (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
H-Shay committed Jun 30, 2022
1 parent 8330fc9 commit 046a651
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions changelog.d/13134.misc
@@ -0,0 +1 @@
Apply ratelimiting earlier in processing of /send request.
3 changes: 3 additions & 0 deletions synapse/handlers/message.py
Expand Up @@ -903,6 +903,9 @@ async def create_and_send_nonmember_event(
await self.clock.sleep(random.randint(1, 10))
raise ShadowBanError()

if ratelimit:
await self.request_ratelimiter.ratelimit(requester, update=False)

# We limit the number of concurrent event sends in a room so that we
# don't fork the DAG too much. If we don't limit then we can end up in
# a situation where event persistence can't keep up, causing
Expand Down

0 comments on commit 046a651

Please sign in to comment.