summary refs log tree commit diff
path: root/synapse/storage
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2015-05-01 13:06:26 +0100
committerErik Johnston <erik@matrix.org>2015-05-01 13:06:26 +0100
commit4011cf1c424708616023493bb2dba89a8554f2d0 (patch)
tree364d20dc234b4dcd3ea345f996cfd10afb2ea1cc /synapse/storage
parentDon't lock user_ips table for upsert. (diff)
downloadsynapse-4011cf1c424708616023493bb2dba89a8554f2d0.tar.xz
Cache latest_event_ids_in_room
Diffstat (limited to 'synapse/storage')
-rw-r--r--synapse/storage/event_federation.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/synapse/storage/event_federation.py b/synapse/storage/event_federation.py
index 8bbb42c27e..fbbcce754b 100644
--- a/synapse/storage/event_federation.py
+++ b/synapse/storage/event_federation.py
@@ -13,7 +13,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-from ._base import SQLBaseStore
+from ._base import SQLBaseStore, cached
 from syutil.base64util import encode_base64
 
 import logging
@@ -96,6 +96,7 @@ class EventFederationStore(SQLBaseStore):
             room_id,
         )
 
+    @cached()
     def get_latest_event_ids_in_room(self, room_id):
         return self._simple_select_onecol(
             table="event_forward_extremities",
@@ -329,6 +330,8 @@ class EventFederationStore(SQLBaseStore):
             )
             txn.execute(query)
 
+            self.get_latest_event_ids_in_room.invalidate(room_id)
+
     def get_backfill_events(self, room_id, event_list, limit):
         """Get a list of Events for a given topic that occurred before (and
         including) the events in event_list. Return a list of max size `limit`