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.
This commit is contained in:
Patrick Cloke 2021-10-08 07:44:43 -04:00 committed by GitHub
parent 49a683d871
commit eb9ddc8c2e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 166 additions and 215 deletions

View file

@ -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,
)