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

@ -32,8 +32,6 @@ from synapse.types import (
get_domain_from_id,
)
from ._base import BaseHandler
if TYPE_CHECKING:
from synapse.server import HomeServer
@ -43,7 +41,7 @@ MAX_DISPLAYNAME_LEN = 256
MAX_AVATAR_URL_LEN = 1000
class ProfileHandler(BaseHandler):
class ProfileHandler:
"""Handles fetching and updating user profile information.
ProfileHandler can be instantiated directly on workers and will
@ -54,7 +52,9 @@ class ProfileHandler(BaseHandler):
PROFILE_UPDATE_EVERY_MS = 24 * 60 * 60 * 1000
def __init__(self, hs: "HomeServer"):
super().__init__(hs)
self.store = hs.get_datastore()
self.clock = hs.get_clock()
self.hs = hs
self.federation = hs.get_federation_client()
hs.get_federation_registry().register_query_handler(
@ -62,6 +62,7 @@ class ProfileHandler(BaseHandler):
)
self.user_directory_handler = hs.get_user_directory_handler()
self.request_ratelimiter = hs.get_request_ratelimiter()
if hs.config.worker.run_background_tasks:
self.clock.looping_call(
@ -346,7 +347,7 @@ class ProfileHandler(BaseHandler):
if not self.hs.is_mine(target_user):
return
await self.ratelimit(requester)
await self.request_ratelimiter.ratelimit(requester)
# Do not actually update the room state for shadow-banned users.
if requester.shadow_banned: