This repository was archived by the owner on Apr 26, 2024. It is now read-only.
make /context lazyload & filter aware#3567
Merged
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.
Member
|
Build finished. |
This was referenced Jul 20, 2018
richvdh
reviewed
Jul 27, 2018
| 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? |
Member
There was a problem hiding this comment.
Member
There was a problem hiding this comment.
(it would be helpful to link to the bug in the comment, I guess)
richvdh
approved these changes
Jul 27, 2018
Member
richvdh
left a comment
There was a problem hiding this comment.
lgtm modulo confusion over comment
synapse/rest/client/v1/room.py
Outdated
|
|
||
| limit = parse_integer(request, "limit", default=10) | ||
|
|
||
| # for symmetry with /messages for now |
Member
There was a problem hiding this comment.
I don't really understand this comment. What do you mean, for now?
richvdh
reviewed
Jul 27, 2018
synapse/handlers/room.py
Outdated
| types = None | ||
| filtered_types = None | ||
| if event_filter and event_filter.lazy_load_members(): | ||
| members = {} |
Member
There was a problem hiding this comment.
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"],
))
Member
Author
|
richvdh @ptal |
Member
Author
|
oh, i missed you lgtm'd it mod the changes. thanks |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Builds on matrix-org/matrix-spec-proposals#3331 (and in turn matrix-org/matrix-spec-proposals#2970)