diff options
author | Patrick Cloke <clokep@users.noreply.github.com> | 2021-10-08 07:44:43 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-08 07:44:43 -0400 |
commit | eb9ddc8c2e807e691fd1820f88f7c0bf43822661 (patch) | |
tree | 65b74a3ce38b3f79c1b667ef99b66511c7662efc /synapse/server.py | |
parent | Fix long-standing bug where `ReadWriteLock` could drop logging contexts (#10993) (diff) | |
download | synapse-eb9ddc8c2e807e691fd1820f88f7c0bf43822661.tar.xz |
Remove the deprecated BaseHandler. (#11005)
The shared ratelimit function was replaced with a dedicated RequestRatelimiter class (accessible from the HomeServer object). Other properties were copied to each sub-class that inherited from BaseHandler.
Diffstat (limited to 'synapse/server.py')
-rw-r--r-- | synapse/server.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/synapse/server.py b/synapse/server.py index 637eb15b78..0783df41d4 100644 --- a/synapse/server.py +++ b/synapse/server.py @@ -39,7 +39,7 @@ from twisted.web.resource import IResource from synapse.api.auth import Auth from synapse.api.filtering import Filtering -from synapse.api.ratelimiting import Ratelimiter +from synapse.api.ratelimiting import Ratelimiter, RequestRatelimiter from synapse.appservice.api import ApplicationServiceApi from synapse.appservice.scheduler import ApplicationServiceScheduler from synapse.config.homeserver import HomeServerConfig @@ -816,3 +816,12 @@ class HomeServer(metaclass=abc.ABCMeta): def should_send_federation(self) -> bool: "Should this server be sending federation traffic directly?" return self.config.worker.send_federation + + @cache_in_self + def get_request_ratelimiter(self) -> RequestRatelimiter: + return RequestRatelimiter( + self.get_datastore(), + self.get_clock(), + self.config.ratelimiting.rc_message, + self.config.ratelimiting.rc_admin_redaction, + ) |