diff options
author | Mark Haines <mark.haines@matrix.org> | 2015-05-21 11:13:19 +0100 |
---|---|---|
committer | Mark Haines <mark.haines@matrix.org> | 2015-05-21 16:41:39 +0100 |
commit | d61ce3f6707c3f13a21733e356766d0292815ebc (patch) | |
tree | f279764864a6898f160b3e7254b9534f7d4dcaeb /synapse/storage/events.py | |
parent | Merge branch 'hotfixes-v0.9.0-r4' of github.com:matrix-org/synapse (diff) | |
download | synapse-d61ce3f6707c3f13a21733e356766d0292815ebc.tar.xz |
Add a cache for get_current_state with state_key
Diffstat (limited to 'synapse/storage/events.py')
-rw-r--r-- | synapse/storage/events.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/synapse/storage/events.py b/synapse/storage/events.py index 38395c66ab..52074b4cc8 100644 --- a/synapse/storage/events.py +++ b/synapse/storage/events.py @@ -107,6 +107,8 @@ class EventsStore(SQLBaseStore): # We purposefully do this first since if we include a `current_state` # key, we *want* to update the `current_state_events` table if current_state: + txn.call_after(self.get_current_state_for_key.invalidate_all) + self._simple_delete_txn( txn, table="current_state_events", @@ -335,6 +337,10 @@ class EventsStore(SQLBaseStore): ) if is_new_state and not context.rejected: + txn.call_after( + self.get_current_state_for_key.invalidate, + event.room_id, event.type, event.state_key + ) self._simple_upsert_txn( txn, "current_state_events", |