Load `/directory/room/{roomAlias}` endpoint on workers (#15333)
* Enable `directory` * move to worker store * newsfile * disable `ClientDirectoryListServer` and `ClientAppserviceDirectoryListServer` for workers
This commit is contained in:
parent
d751f65e71
commit
4af0aec54d
|
@ -0,0 +1 @@
|
|||
Allow loading `/directory/room/{roomAlias}` endpoint on workers.
|
|
@ -173,6 +173,7 @@ WORKERS_CONFIG: Dict[str, Dict[str, Any]] = {
|
|||
"^/_matrix/client/(api/v1|r0|v3|unstable)/search",
|
||||
"^/_matrix/client/(r0|v3|unstable)/user/.*/filter(/|$)",
|
||||
"^/_matrix/client/(r0|v3|unstable)/password_policy$",
|
||||
"^/_matrix/client/(api/v1|r0|v3|unstable)/directory/room/.*$",
|
||||
],
|
||||
"shared_extra_conf": {},
|
||||
"worker_extra_conf": "",
|
||||
|
|
|
@ -234,6 +234,7 @@ information.
|
|||
^/_matrix/client/(api/v1|r0|v3|unstable/.*)/rooms/.*/aliases
|
||||
^/_matrix/client/(api/v1|r0|v3|unstable)/search$
|
||||
^/_matrix/client/(r0|v3|unstable)/user/.*/filter(/|$)
|
||||
^/_matrix/client/(api/v1|r0|v3|unstable)/directory/room/.*$
|
||||
|
||||
# Encryption requests
|
||||
^/_matrix/client/(r0|v3|unstable)/keys/query$
|
||||
|
|
|
@ -100,7 +100,6 @@ 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)
|
||||
voip.register_servlets(hs, client_resource)
|
||||
if is_main_process:
|
||||
|
|
|
@ -39,12 +39,14 @@ logger = logging.getLogger(__name__)
|
|||
|
||||
def register_servlets(hs: "HomeServer", http_server: HttpServer) -> None:
|
||||
ClientDirectoryServer(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__()
|
||||
|
|
|
@ -129,8 +129,6 @@ class DirectoryWorkerStore(CacheInvalidationWorkerStore):
|
|||
409, "Room alias %s already exists" % room_alias.to_string()
|
||||
)
|
||||
|
||||
|
||||
class DirectoryStore(DirectoryWorkerStore):
|
||||
async def delete_room_alias(self, room_alias: RoomAlias) -> Optional[str]:
|
||||
room_id = await self.db_pool.runInteraction(
|
||||
"delete_room_alias", self._delete_room_alias_txn, room_alias
|
||||
|
@ -201,3 +199,7 @@ class DirectoryStore(DirectoryWorkerStore):
|
|||
await self.db_pool.runInteraction(
|
||||
"_update_aliases_for_room_txn", _update_aliases_for_room_txn
|
||||
)
|
||||
|
||||
|
||||
class DirectoryStore(DirectoryWorkerStore):
|
||||
pass
|
||||
|
|
Loading…
Reference in New Issue