summary refs log tree commit diff
path: root/synapse/handlers/room_list.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2019-03-19 16:50:51 +0000
committerErik Johnston <erik@matrix.org>2019-03-19 17:10:52 +0000
commit213c98c00a473bac7363e1a728828e0f056550b8 (patch)
tree8ab1c9dcf73cb3bb0263f9e25c9dfe20bce45bce /synapse/handlers/room_list.py
parentMerge pull request #4894 from matrix-org/erikj/postgres_tuning (diff)
downloadsynapse-213c98c00a473bac7363e1a728828e0f056550b8.tar.xz
Add option to disable search room lists
This disables both local and remote room list searching.
Diffstat (limited to 'synapse/handlers/room_list.py')
-rw-r--r--synapse/handlers/room_list.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/synapse/handlers/room_list.py b/synapse/handlers/room_list.py
index afa508d729..ba50c8aa95 100644
--- a/synapse/handlers/room_list.py
+++ b/synapse/handlers/room_list.py
@@ -44,6 +44,7 @@ EMPTY_THIRD_PARTY_ID = ThirdPartyInstanceID(None, None)
 class RoomListHandler(BaseHandler):
     def __init__(self, hs):
         super(RoomListHandler, self).__init__(hs)
+        self.config = hs.config
         self.response_cache = ResponseCache(hs, "room_list")
         self.remote_response_cache = ResponseCache(hs, "remote_room_list",
                                                    timeout_ms=30 * 1000)
@@ -70,6 +71,12 @@ class RoomListHandler(BaseHandler):
             "Getting public room list: limit=%r, since=%r, search=%r, network=%r",
             limit, since_token, bool(search_filter), network_tuple,
         )
+        if not self.config.enable_room_list_search:
+            return defer.succeed({
+                "chunk": [],
+                "total_room_count_estimate": 0,
+            })
+
         if search_filter:
             # We explicitly don't bother caching searches or requests for
             # appservice specific lists.
@@ -441,6 +448,12 @@ class RoomListHandler(BaseHandler):
     def get_remote_public_room_list(self, server_name, limit=None, since_token=None,
                                     search_filter=None, include_all_networks=False,
                                     third_party_instance_id=None,):
+        if not self.config.enable_room_list_search:
+            defer.returnValue({
+                "chunk": [],
+                "total_room_count_estimate": 0,
+            })
+
         if search_filter:
             # We currently don't support searching across federation, so we have
             # to do it manually without pagination