diff options
author | Erik Johnston <erik@matrix.org> | 2015-05-21 17:02:54 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2015-05-21 17:02:54 +0100 |
commit | f6d1183fc5f5e687818e6d83394bbd571d24c633 (patch) | |
tree | c6b74e6ee0925ba9b31ef2f1fdb0fb1de9dd20ac /synapse/storage/events.py | |
parent | Merge branch 'hotfixes-v0.9.0-r4' of github.com:matrix-org/synapse (diff) | |
parent | Don't try to use a txn when not in one, remove spurious debug logging (diff) | |
download | synapse-f6d1183fc5f5e687818e6d83394bbd571d24c633.tar.xz |
Merge branch 'markjh/pusher_performance_master' of github.com:matrix-org/synapse into hotfixes-v0.9.0-r5
Diffstat (limited to 'synapse/storage/events.py')
-rw-r--r-- | synapse/storage/events.py | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/synapse/storage/events.py b/synapse/storage/events.py index 38395c66ab..1304219e86 100644 --- a/synapse/storage/events.py +++ b/synapse/storage/events.py @@ -107,6 +107,12 @@ 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) + 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, table="current_state_events", @@ -114,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", @@ -335,6 +334,18 @@ 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 + ) + + 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", |