summary refs log tree commit diff
path: root/synapse/storage/databases/main/events.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2022-03-25 14:58:56 +0000
committerGitHub <noreply@github.com>2022-03-25 14:58:56 +0000
commit7ca8ee67a5165e33f03454218c81be96397e7591 (patch)
treee847a8e53e76b7dfc330e66f28d3ce6e6a3f73e7 /synapse/storage/databases/main/events.py
parentEnhance logging for inbound federation events (#12301) (diff)
downloadsynapse-7ca8ee67a5165e33f03454218c81be96397e7591.tar.xz
Add cache for `get_membership_from_event_ids` (#12272)
This should speed up push rule calculations for rooms with large numbers of local users when the main push rule cache fails.

Co-authored-by: reivilibre <oliverw@matrix.org>
Diffstat (limited to 'synapse/storage/databases/main/events.py')
-rw-r--r--synapse/storage/databases/main/events.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/synapse/storage/databases/main/events.py b/synapse/storage/databases/main/events.py

index 1f60aef180..d253243125 100644 --- a/synapse/storage/databases/main/events.py +++ b/synapse/storage/databases/main/events.py
@@ -1745,6 +1745,13 @@ class PersistEventsStore: (event.state_key,), ) + # The `_get_membership_from_event_id` is immutable, except for the + # case where we look up an event *before* persisting it. + txn.call_after( + self.store._get_membership_from_event_id.invalidate, + (event.event_id,), + ) + # We update the local_current_membership table only if the event is # "current", i.e., its something that has just happened. #