summary refs log tree commit diff
path: root/synapse/visibility.py
diff options
context:
space:
mode:
authorRichard van der Hoff <1389908+richvdh@users.noreply.github.com>2022-04-26 10:27:11 +0100
committerGitHub <noreply@github.com>2022-04-26 10:27:11 +0100
commit17d99f758a768b886842cf496ff236fbe3829236 (patch)
treebd2c3b7f5cf2386d33d4224f9e2533611f288f08 /synapse/visibility.py
parentAdd a table of contents to config manual (#12527) (diff)
downloadsynapse-17d99f758a768b886842cf496ff236fbe3829236.tar.xz
Optimise backfill calculation (#12522)
Try to avoid an OOM by checking fewer extremities.

Generally this is a big rewrite of _maybe_backfill, to try and fix some of the TODOs and other problems in it. It's best reviewed commit-by-commit.
Diffstat (limited to 'synapse/visibility.py')
-rw-r--r--synapse/visibility.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/synapse/visibility.py b/synapse/visibility.py

index 250f073597..de6d2ffc52 100644 --- a/synapse/visibility.py +++ b/synapse/visibility.py
@@ -419,6 +419,13 @@ async def _event_to_memberships( return {} # for each event, get the event_ids of the membership state at those events. + # + # TODO: this means that we request the entire membership list. If there are only + # one or two users on this server, and the room is huge, this is very wasteful + # (it means more db work, and churns the *stateGroupMembersCache*). + # It might be that we could extend StateFilter to specify "give me keys matching + # *:<server_name>", to avoid this. + event_to_state_ids = await storage.state.get_state_ids_for_events( frozenset(e.event_id for e in events), state_filter=StateFilter.from_types(types=((EventTypes.Member, None),)),