-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Avoid unnecessary work in the spaces summary. #10085
Conversation
e947f16
to
926e32d
Compare
This is going to fail complement tests since that depends on the old behavior, I'm not really sure how to get complement and synapse on the same page in this instance. 😢 |
d05fb66
to
1cae18a
Compare
1cae18a
to
e8f2995
Compare
synapse/handlers/space_summary.py
Outdated
# Note that events are pending of the child event since if | ||
# the parent event was not accessible it shouldn't be included | ||
# at all. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really follow this logic. Why do we only add the event to the pending list for the child room?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The thought process was that we only want to send the event in the case of both the parent and child room being accessible to the requester.
I think the assumption here is that if the parent room isn't in processed_rooms
something terrible has happened? There are two sources of data we're iterating over:
events
-m.space.child
events from the current room.- For local rooms, the parent will be the current room, the child will be a room that may or may not have been processed.
- For remote rooms, this includes the above, as well as additional events that might be children of children, etc. (Or even events that aren't part of the graph.)
room_pending_events
-m.space.child
events which were previously found to be pointing to the current room, i.e. the child room is the current room and the parent room is a previously processed room.
I'm now having trouble convincing myself that parents must be processed before children and I think that assumption might be bogus actually.
I'm going to merge #10208 into this and build out some more tests to ensure this is working as I expect. |
I'm going to abandon this and re-do this work. |
This has a few different changes in separate commits:
m.child.space
events in spaces, not all rooms.events
which point to inaccessible rooms (or are otherwise not part of the graph).The first and the third bullets are driven by doing work that the clients drop on the floor (they do not show a normal room as a space and do not care about events with not matching room). The MSC was updated with these changes.
My hope is that this will help servers which have a slow database (or are starved for CPU, maybe). There's been some reports of the endpoint being very slow.
There is a corresponding complement PR: matrix-org/complement#123.
This depends on #10160 being merged first.
This is also some prep work for handling pagination in a roundabout way.