-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
make /context lazyload & filter aware #3567
Conversation
as per the proposal; we can deduplicate redundant lazy-loaded members which are sent in the same sync sequence. we do this heuristically rather than requiring the client to somehow tell us which members it has chosen to cache, by instead caching the last N members sent to a client, and not sending them again. For now we hardcode N to 100. Each cache for a given (user,device) tuple is in turn cached for up to X minutes (to avoid the caches building up). For now we hardcode X to 30.
Build finished. |
synapse/handlers/room.py
Outdated
types = [(EventTypes.Member, member) for member in members.keys()] | ||
|
||
# XXX: why do we return the state as of the last event rather than the | ||
# first? Shouldn't we be consistent with /sync? |
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.
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.
(it would be helpful to link to the bug in the comment, I guess)
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.
lgtm modulo confusion over comment
synapse/rest/client/v1/room.py
Outdated
@@ -531,11 +531,20 @@ def on_GET(self, request, room_id, event_id): | |||
|
|||
limit = parse_integer(request, "limit", default=10) | |||
|
|||
# for symmetry with /messages for now |
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 understand this comment. What do you mean, for now?
synapse/handlers/room.py
Outdated
types = None | ||
filtered_types = None | ||
if event_filter and event_filter.lazy_load_members(): | ||
members = {} |
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.
hrm, can we use a set rather than a dict here?
members = set()
# ...
members.add(ev.sender)
or even:
members = set(ev.sender for ev in itertools.chain(
results["events_before"],
(results["event"],),
results["events_after"],
))
richvdh @ptal |
oh, i missed you lgtm'd it mod the changes. thanks |
Builds on matrix-org/matrix-spec-proposals#3331 (and in turn matrix-org/matrix-spec-proposals#2970)