Add configurable rate limiting for the creation of rooms.#18514
Add configurable rate limiting for the creation of rooms.#18514reivilibre merged 7 commits intodevelopfrom
Conversation
| await self.common_request_ratelimiter.ratelimit(requester) | ||
| await self.creation_ratelimiter.ratelimit(requester) |
There was a problem hiding this comment.
it's an open question if we want them both or not, but since room creation consuming tokens from the general bucket was implicitly relied upon by tests, I thought I should leave it like that for now
There was a problem hiding this comment.
Yeah - this is the bit I'm unsure of. Would need to dig into this further to see what we should be doing here, and if this is in fact the right thing to do.
| self.rc_room_creation = RatelimitSettings.parse( | ||
| config, | ||
| "rc_room_creation", | ||
| defaults={"per_second": 0.016, "burst_count": 10}, |
There was a problem hiding this comment.
interesting per_second value... almost 1 per minute?
I don't have a problem with it, but it might warrant a comment
There was a problem hiding this comment.
hmm yeah, not sure what would be a good default
|
Oh, and in general this PR will need to update the docs to refect the new config option. |
d305fb4 to
98ed365
Compare
erikjohnston
left a comment
There was a problem hiding this comment.
Though has merge conflicts
Default values will be 1 room per minute, with a burst count of 10.
It's hard to imagine most users will be affected by this default rate, but it's intentionally non-invasive in case of bots or other users that need to create rooms at a large rate.
Server admins might want to down-tune this on their deployments.