mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2025-05-31 11:24:15 -04:00
Batch fetch bundled references (#14508)
Avoid an n+1 query problem and fetch the bundled aggregations for m.reference relations in a single query instead of a query per event. This applies similar logic for as was previously done for edits in8b309adb43
(#11660; threads inb65acead42
(#11752); and annotations in1799a54a54
(#14491).
This commit is contained in:
parent
1799a54a54
commit
6d7523ef14
6 changed files with 133 additions and 79 deletions
|
@ -2049,6 +2049,10 @@ class PersistEventsStore:
|
|||
self.store._invalidate_cache_and_stream(
|
||||
txn, self.store.get_aggregation_groups_for_event, (redacted_relates_to,)
|
||||
)
|
||||
if rel_type == RelationTypes.REFERENCE:
|
||||
self.store._invalidate_cache_and_stream(
|
||||
txn, self.store.get_references_for_event, (redacted_relates_to,)
|
||||
)
|
||||
if rel_type == RelationTypes.REPLACE:
|
||||
self.store._invalidate_cache_and_stream(
|
||||
txn, self.store.get_applicable_edit, (redacted_relates_to,)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue