0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-11-16 06:51:46 +01:00

Don't process /send requests for users who have hit their ratelimit (#13134)

This commit is contained in:
Shay 2022-06-30 09:22:40 -07:00 committed by GitHub
parent 8330fc9953
commit 046a6513bc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 0 deletions

1
changelog.d/13134.misc Normal file
View file

@ -0,0 +1 @@
Apply ratelimiting earlier in processing of /send request.

View file

@ -903,6 +903,9 @@ class EventCreationHandler:
await self.clock.sleep(random.randint(1, 10)) await self.clock.sleep(random.randint(1, 10))
raise ShadowBanError() 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 # 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 # 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 # a situation where event persistence can't keep up, causing