This repository was archived by the owner on Apr 26, 2024. It is now read-only.
Apply join rate limiter outside the lineariser#16441
Merged
DMRobertson merged 5 commits intodevelopfrom Oct 6, 2023
Merged
Conversation
46430de to
35bd3ae
Compare
clokep
approved these changes
Oct 6, 2023
Member
clokep
left a comment
There was a problem hiding this comment.
Good w/ me if tests look good.
Comment on lines
+618
to
+624
| if current_membership != Membership.JOIN: | ||
| await self._join_rate_limiter_local.ratelimit(requester) | ||
| await self._join_rate_per_room_limiter.ratelimit( | ||
| requester, key=room_id, update=False | ||
| ) | ||
| elif action == Membership.INVITE: | ||
| await self.ratelimit_invite(requester, room_id, target.to_string()) |
Member
There was a problem hiding this comment.
Nice consolidation here. 👍
I wondered why we couldn't remove ratelimit from other spots, but we pass it into handle_new_client_event.
Contributor
Author
There was a problem hiding this comment.
I had the same thought (sorry, should have left a comment to this effect), and decided that I was too scared to see if the ratelimiting logic was further disentangleable.
Member
There was a problem hiding this comment.
Completely fair, I think this is a solid improvement.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I came across this logic; got confused, then tried to tidy it up. I found this much easier to reason about---doing the rate limit check up front.
At some point, someone should draw out a flowchart of the various membership-updating functions here. It's very confusing.
Commitwise reviewable.