diff options
author | Mark Haines <mark.haines@matrix.org> | 2015-05-21 15:14:26 +0100 |
---|---|---|
committer | Mark Haines <mark.haines@matrix.org> | 2015-05-21 16:41:39 +0100 |
commit | 53447e9cd380262c16677cfddeda1d75aeebe38c (patch) | |
tree | cf563422554aa7308b9df7ee9f0b13fd3a88b33d /synapse/storage/events.py | |
parent | Add a cache for get_current_state with state_key (diff) | |
download | synapse-53447e9cd380262c16677cfddeda1d75aeebe38c.tar.xz |
Add caches for things requested by the pushers
Diffstat (limited to 'synapse/storage/events.py')
-rw-r--r-- | synapse/storage/events.py | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/synapse/storage/events.py b/synapse/storage/events.py index 52074b4cc8..1304219e86 100644 --- a/synapse/storage/events.py +++ b/synapse/storage/events.py @@ -108,6 +108,10 @@ class EventsStore(SQLBaseStore): # key, we *want* to update the `current_state_events` table if current_state: txn.call_after(self.get_current_state_for_key.invalidate_all) + txn.call_after(self.get_rooms_for_user.invalidate_all) + txn.call_after(self.get_users_in_room.invalidate, event.room_id) + txn.call_after(self.get_joined_hosts_for_room.invalidate, event.room_id) + txn.call_after(self.get_room_name_and_aliases, event.room_id) self._simple_delete_txn( txn, @@ -116,13 +120,6 @@ class EventsStore(SQLBaseStore): ) for s in current_state: - if s.type == EventTypes.Member: - txn.call_after( - self.get_rooms_for_user.invalidate, s.state_key - ) - txn.call_after( - self.get_joined_hosts_for_room.invalidate, s.room_id - ) self._simple_insert_txn( txn, "current_state_events", @@ -341,6 +338,14 @@ class EventsStore(SQLBaseStore): self.get_current_state_for_key.invalidate, event.room_id, event.type, event.state_key ) + + if (event.type == EventTypes.Name + or event.type == EventTypes.Aliases): + txn.call_after( + self.get_room_name_and_aliases.invalidate, + event.room_id + ) + self._simple_upsert_txn( txn, "current_state_events", |