mirror of
https://github.com/element-hq/synapse.git
synced 2026-08-16 13:20:39 +00:00
* The prefetch window iterated the queue in the opposite order to the pops. A room can appear in the queue more than once (linked from two spaces; the queue is only deduped at pop time), so the entry whose summary got computed could be the wrong one - summarising with another parent's via/depth. Iterate in pop order. * Bound the prefetch window by the number of rooms still needed for the page, so a small ?limit= no longer speculatively issues (and then discards) up to ten federation requests. * Cap how many children are summarised at once when answering a federation hierarchy request: that endpoint is reachable by any federating server, and each summary now fans out internally, so an uncapped gather over 50 children could monopolise the DB pool. * get_room_with_stats caches None for unknown rooms, and the federation hierarchy endpoint summarises whatever room id it is asked about, so a negative entry could outlive the room's creation (the stats writer only invalidates once it catches up) and trip _build_room_entry's assert. Invalidate on the room-creation paths, and omit the room from the summary rather than asserting if it has no room entry. * Lower get_room_hierarchy_state's max_entries: values hold every m.space.child event of the room, so entries are not uniformly small.