summary refs log tree commit diff
path: root/synapse/app
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2020-08-11 18:00:17 +0100
committerErik Johnston <erik@matrix.org>2020-08-11 18:00:17 +0100
commit0f1afbe8dc853c8726de797ede10cad2fe336b16 (patch)
treeb80df118d1c2a0a35fb745b47153284a9f97a9aa /synapse/app
parentMerge remote-tracking branch 'origin/master' into develop (diff)
downloadsynapse-0f1afbe8dc853c8726de797ede10cad2fe336b16.tar.xz
Change HomeServer definition to work with typing.
Duplicating function signatures between server.py and server.pyi is
silly. This commit changes that by changing all `build_*` methods to
`get_*` methods and changing the `_make_dependency_method` to work work
as a descriptor that caches the produced value.

There are some changes in other files that were made to fix the typing
in server.py.
Diffstat (limited to 'synapse/app')
-rw-r--r--synapse/app/generic_worker.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/synapse/app/generic_worker.py b/synapse/app/generic_worker.py
index 7957586d69..739b013d4c 100644
--- a/synapse/app/generic_worker.py
+++ b/synapse/app/generic_worker.py
@@ -125,7 +125,7 @@ from synapse.rest.client.v2_alpha.register import RegisterRestServlet
 from synapse.rest.client.versions import VersionsRestServlet
 from synapse.rest.health import HealthResource
 from synapse.rest.key.v2 import KeyApiV2Resource
-from synapse.server import HomeServer
+from synapse.server import HomeServer, cache_in_self
 from synapse.storage.databases.main.censor_events import CensorEventsStore
 from synapse.storage.databases.main.media_repository import MediaRepositoryStore
 from synapse.storage.databases.main.monthly_active_users import (
@@ -635,10 +635,12 @@ class GenericWorkerServer(HomeServer):
     async def remove_pusher(self, app_id, push_key, user_id):
         self.get_tcp_replication().send_remove_pusher(app_id, push_key, user_id)
 
-    def build_replication_data_handler(self):
+    @cache_in_self
+    def get_replication_data_handler(self):
         return GenericWorkerReplicationHandler(self)
 
-    def build_presence_handler(self):
+    @cache_in_self
+    def get_presence_handler(self):
         return GenericWorkerPresence(self)