diff options
author | Erik Johnston <erik@matrix.org> | 2018-08-22 10:13:40 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2018-08-22 10:13:40 +0100 |
commit | 8432e2ebd76d0462d39a329967671e845da7e404 (patch) | |
tree | e2bcb73eca0f48d0acc3260f7da440b944fbd157 /synapse | |
parent | Add assert to ensure handler is only run on master (diff) | |
download | synapse-8432e2ebd76d0462d39a329967671e845da7e404.tar.xz |
Rename WorkerProfileHandler to BaseProfileHandler
Diffstat (limited to 'synapse')
-rw-r--r-- | synapse/handlers/profile.py | 13 | ||||
-rw-r--r-- | synapse/server.py | 4 |
2 files changed, 12 insertions, 5 deletions
diff --git a/synapse/handlers/profile.py b/synapse/handlers/profile.py index 278f131d5e..75b8b7ce6a 100644 --- a/synapse/handlers/profile.py +++ b/synapse/handlers/profile.py @@ -32,9 +32,16 @@ from ._base import BaseHandler logger = logging.getLogger(__name__) -class WorkerProfileHandler(BaseHandler): +class BaseProfileHandler(BaseHandler): + """Handles fetching and updating user profile information. + + BaseProfileHandler can be instantiated directly on workers and will + delegate to master when necessary. The master process should use the + subclass MasterProfileHandler + """ + def __init__(self, hs): - super(WorkerProfileHandler, self).__init__(hs) + super(BaseProfileHandler, self).__init__(hs) self.federation = hs.get_federation_client() hs.get_federation_registry().register_query_handler( @@ -275,7 +282,7 @@ class WorkerProfileHandler(BaseHandler): ) -class MasterProfileHandler(WorkerProfileHandler): +class MasterProfileHandler(BaseProfileHandler): PROFILE_UPDATE_MS = 60 * 1000 PROFILE_UPDATE_EVERY_MS = 24 * 60 * 60 * 1000 diff --git a/synapse/server.py b/synapse/server.py index fcfa7e6557..a6fbc6ec0c 100644 --- a/synapse/server.py +++ b/synapse/server.py @@ -56,7 +56,7 @@ from synapse.handlers.initial_sync import InitialSyncHandler from synapse.handlers.message import EventCreationHandler, MessageHandler from synapse.handlers.pagination import PaginationHandler from synapse.handlers.presence import PresenceHandler -from synapse.handlers.profile import MasterProfileHandler, WorkerProfileHandler +from synapse.handlers.profile import BaseProfileHandler, MasterProfileHandler from synapse.handlers.read_marker import ReadMarkerHandler from synapse.handlers.receipts import ReceiptsHandler from synapse.handlers.room import RoomContextHandler, RoomCreationHandler @@ -309,7 +309,7 @@ class HomeServer(object): def build_profile_handler(self): if self.config.worker_app: - return WorkerProfileHandler(self) + return BaseProfileHandler(self) else: return MasterProfileHandler(self) |