Load `/directory/room/{roomAlias}` endpoint on workers (#15333)
* Enable `directory`
* move to worker store
* newsfile
* disable `ClientDirectoryListServer` and `ClientAppserviceDirectoryListServer` for workers
2 files changed, 5 insertions, 4 deletions
diff --git a/synapse/rest/__init__.py b/synapse/rest/__init__.py
index 1d7c11b42d..19603ed137 100644
--- a/synapse/rest/__init__.py
+++ b/synapse/rest/__init__.py
@@ -100,8 +100,7 @@ class ClientRestResource(JsonResource):
login.register_servlets(hs, client_resource)
profile.register_servlets(hs, client_resource)
presence.register_servlets(hs, client_resource)
- if is_main_process:
- directory.register_servlets(hs, client_resource)
+ directory.register_servlets(hs, client_resource)
voip.register_servlets(hs, client_resource)
if is_main_process:
pusher.register_servlets(hs, client_resource)
diff --git a/synapse/rest/client/directory.py b/synapse/rest/client/directory.py
index f17b4c8d22..570bb52747 100644
--- a/synapse/rest/client/directory.py
+++ b/synapse/rest/client/directory.py
@@ -39,12 +39,14 @@ logger = logging.getLogger(__name__)
def register_servlets(hs: "HomeServer", http_server: HttpServer) -> None:
ClientDirectoryServer(hs).register(http_server)
- ClientDirectoryListServer(hs).register(http_server)
- ClientAppserviceDirectoryListServer(hs).register(http_server)
+ if hs.config.worker.worker_app is None:
+ ClientDirectoryListServer(hs).register(http_server)
+ ClientAppserviceDirectoryListServer(hs).register(http_server)
class ClientDirectoryServer(RestServlet):
PATTERNS = client_patterns("/directory/room/(?P<room_alias>[^/]*)$", v1=True)
+ CATEGORY = "Client API requests"
def __init__(self, hs: "HomeServer"):
super().__init__()
|