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/handlers/profile.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/handlers/profile.py')
-rw-r--r-- | synapse/handlers/profile.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/synapse/handlers/profile.py b/synapse/handlers/profile.py index 2e19706c69..e6c3cf585b 100644 --- a/synapse/handlers/profile.py +++ b/synapse/handlers/profile.py @@ -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: |