summary refs log tree commit diff
path: root/synapse/storage/state.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2016-03-23 11:37:58 +0000
committerErik Johnston <erik@matrix.org>2016-03-23 11:42:17 +0000
commit8b0dfc9fc4e98ea9c029c5f7b49efaf011ce1979 (patch)
treeb5cb8fdb560facf2abd0d3458c1d9296532b2496 /synapse/storage/state.py
parentMeasure StateHandler._resolve_events (diff)
downloadsynapse-8b0dfc9fc4e98ea9c029c5f7b49efaf011ce1979.tar.xz
Don't cache events in get_current_state_for_key
Diffstat (limited to 'synapse/storage/state.py')
-rw-r--r--synapse/storage/state.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/synapse/storage/state.py b/synapse/storage/state.py
index f06c734c4e..eab2c5a8ce 100644
--- a/synapse/storage/state.py
+++ b/synapse/storage/state.py
@@ -14,9 +14,7 @@
 # limitations under the License.
 
 from ._base import SQLBaseStore
-from synapse.util.caches.descriptors import (
-    cached, cachedInlineCallbacks, cachedList
-)
+from synapse.util.caches.descriptors import cached, cachedList
 
 from twisted.internet import defer
 
@@ -155,8 +153,14 @@ class StateStore(SQLBaseStore):
         events = yield self._get_events(event_ids, get_prev_content=False)
         defer.returnValue(events)
 
-    @cachedInlineCallbacks(num_args=3)
+    @defer.inlineCallbacks
     def get_current_state_for_key(self, room_id, event_type, state_key):
+        event_ids = yield self._get_current_state_for_key(room_id, event_type, state_key)
+        events = yield self._get_events(event_ids, get_prev_content=False)
+        defer.returnValue(events)
+
+    @cached(num_args=3)
+    def _get_current_state_for_key(self, room_id, event_type, state_key):
         def f(txn):
             sql = (
                 "SELECT event_id FROM current_state_events"
@@ -167,9 +171,7 @@ class StateStore(SQLBaseStore):
             txn.execute(sql, args)
             results = txn.fetchall()
             return [r[0] for r in results]
-        event_ids = yield self.runInteraction("get_current_state_for_key", f)
-        events = yield self._get_events(event_ids, get_prev_content=False)
-        defer.returnValue(events)
+        return self.runInteraction("get_current_state_for_key", f)
 
     def _get_state_groups_from_groups(self, groups, types):
         """Returns dictionary state_group -> (dict of (type, state_key) -> event id)