summary refs log tree commit diff
path: root/synapse/handlers
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2017-03-13 09:50:10 +0000
committerErik Johnston <erik@matrix.org>2017-03-13 09:50:10 +0000
commit79926e016e98d4074aac4803d4d262dfd9c570c4 (patch)
treece55258ff17025142691b9f978017c91669eba34 /synapse/handlers
parentGet current state by using current_state_events table (diff)
downloadsynapse-79926e016e98d4074aac4803d4d262dfd9c570c4.tar.xz
Assume rooms likely haven't changed
Diffstat (limited to 'synapse/handlers')
-rw-r--r--synapse/handlers/room_list.py19
1 files changed, 11 insertions, 8 deletions
diff --git a/synapse/handlers/room_list.py b/synapse/handlers/room_list.py
index 6283caaf79..2f82c520ca 100644
--- a/synapse/handlers/room_list.py
+++ b/synapse/handlers/room_list.py
@@ -120,16 +120,19 @@ class RoomListHandler(BaseHandler):
 
         @defer.inlineCallbacks
         def get_order_for_room(room_id):
-            latest_event_ids = yield self.store.get_forward_extremeties_for_room(
-                room_id, stream_token
-            )
+            joined_users = yield self.store.get_users_in_room(room_id)
+            if self.store.has_room_changed_since(room_id, stream_token):
+                latest_event_ids = yield self.store.get_forward_extremeties_for_room(
+                    room_id, stream_token
+                )
 
-            if not latest_event_ids:
-                return
+                if not latest_event_ids:
+                    return
+
+                joined_users = yield self.state_handler.get_current_user_in_room(
+                    room_id, latest_event_ids,
+                )
 
-            joined_users = yield self.state_handler.get_current_user_in_room(
-                room_id, latest_event_ids,
-            )
             num_joined_users = len(joined_users)
             rooms_to_num_joined[room_id] = num_joined_users