Implement per-room rate-limiting for remote joins #12710
Description
Description:
Synapse includes a few different levers for controlling the flow of actions. We should add a new lever, and limit the number of joins to a room in a given time, including remote joins. I.e. if there has recently been lots of joins in a room (local or remote joins), then servers should ratelimit both local joins and remote attempts to join via /make_join
.
By using the existing rate-limit infrastructure, we can tackle some of the issues set out in #12578 around disruptive mass-join events. Rate-limiting helps to prevent performance concerns from handling too many join events at once, and also gives time and space for room moderators to put in place further protections.
Ideally, this limit could be adjusted on a room-by-room basis. Large public rooms would be able to adjust their individual rate-limits, while the default would protect the majority of rooms