diff options
author | Erik Johnston <erik@matrix.org> | 2015-04-30 10:16:12 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2015-04-30 10:16:12 +0100 |
commit | 1d7702833d27f2e87e6598b5de9aad878e716c4b (patch) | |
tree | f38bd329f3b2043353f105f3adcd2652c945c7ce | |
parent | Correctly decode, for sqlite and postgres, rows from pushers table (diff) | |
download | synapse-1d7702833d27f2e87e6598b5de9aad878e716c4b.tar.xz |
Make simple query rather than long one and then throw away half the results
-rw-r--r-- | synapse/handlers/message.py | 3 | ||||
-rw-r--r-- | synapse/storage/room.py | 10 |
2 files changed, 11 insertions, 2 deletions
diff --git a/synapse/handlers/message.py b/synapse/handlers/message.py index 9667bb8674..22e19af17f 100644 --- a/synapse/handlers/message.py +++ b/synapse/handlers/message.py @@ -267,8 +267,7 @@ class MessageHandler(BaseHandler): user, pagination_config.get_source_config("presence"), None ) - public_rooms = yield self.store.get_rooms(is_public=True) - public_room_ids = [r["room_id"] for r in public_rooms] + public_room_ids = yield self.store.get_public_room_ids() limit = pagin_config.limit if limit is None: diff --git a/synapse/storage/room.py b/synapse/storage/room.py index 48ebb33057..2e77b9d79b 100644 --- a/synapse/storage/room.py +++ b/synapse/storage/room.py @@ -75,6 +75,16 @@ class RoomStore(SQLBaseStore): allow_none=True, ) + def get_public_room_ids(self): + return self._simple_select_onecol( + table="rooms", + keyvalues={ + "is_public": True, + }, + retcol="room_id", + desc="get_public_room_ids", + ) + @defer.inlineCallbacks def get_rooms(self, is_public): """Retrieve a list of all public rooms. |