dendrite/syncapi/routing
Till eb29a31550
Optimize /sync and history visibility (#2961)
Should fix the following issues or make a lot less worse when using
Postgres:

The main issue behind #2911: The client gives up after a certain time,
causing a cascade of context errors, because the response couldn't be
built up fast enough. This mostly happens on accounts with many rooms,
due to the inefficient way we're getting recent events and current state

For #2777: The queries for getting the membership events for history
visibility were being executed for each room (I think 185?), resulting
in a whooping 2k queries for membership events. (Getting the
statesnapshot -> block nids -> actual wanted membership event)

Both should now be better by:
- Using a LATERAL join to get all recent events for all joined rooms in
one go (TODO: maybe do the same for room summary and current state etc)
- If we're lazy loading on initial syncs, we're now not getting the
whole current state, just to drop the majority of it because we're lazy
loading members - we add a filter to exclude membership events on the
first call to `CurrentState`.
- Using an optimized query to get the membership events needed to
calculate history visibility

---------

Co-authored-by: kegsay <kegan@matrix.org>
2023-02-07 14:31:23 +01:00
..
context_test.go Return state on calls to /message and lazy load members (#2218) 2022-03-01 14:39:56 +00:00
context.go Optimize /sync and history visibility (#2961) 2023-02-07 14:31:23 +01:00
filter.go Do not use ioutil as it is deprecated (#2625) 2022-08-05 10:26:59 +01:00
getevent.go Move /event to the SyncAPI (#2782) 2022-10-10 12:19:16 +02:00
memberships.go /sync performance optimizations (#2927) 2023-01-17 10:08:23 +01:00
messages.go Optimize /sync and history visibility (#2961) 2023-02-07 14:31:23 +01:00
relations.go Event relations (#2790) 2022-10-13 14:50:52 +01:00
routing.go Deny guest access on several endpoints (#2873) 2022-11-11 10:52:08 +01:00
search.go Don't limit "state" (#2849) 2022-11-02 09:34:19 +00:00