Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/get space hierarchy cache #1885

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

WilsonLe
Copy link

No description provided.

@WilsonLe WilsonLe requested a review from a team as a code owner July 23, 2024 14:27
@CLAassistant
Copy link

CLAassistant commented Jul 23, 2024

CLA assistant check
All committers have signed the CLA.

@nico-famedly
Copy link
Member

This includes changes from authors, that haven't signed the CLA. Could you ask them to sign the CLA or remove their contribution?

@@ -2315,6 +2316,10 @@ class Client extends MatrixApi {
}
onEvent.add(update);

if (event.type == EventTypes.SpaceChild) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You also need to trigger this, when a parent is changed, since you don't need both relations.

@@ -3323,6 +3328,55 @@ class Client extends MatrixApi {
waitUntilLoadCompletedLoaded: false,
);
}

@override
Future<GetSpaceHierarchyResponse> getSpaceHierarchy(String roomId,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You seem to just be caching the whole response. This can introduce some weirdness if you mix cached and uncached responses. Additionally such responses shouldn't be cached indefinitely, I would say.

You also aren't indexing your cache entries by the other parameters for the request, which means for spaces with more than "limit" entries in the response, you will be returning the wrong response. You will also return the wrong response if any of the parameters (apart from the roomid) changes. Additionally you aren't invalidating the cache if a subspace member changes, which means for any depth > 1 this will yield wrong results, if the subspace changes.

I think this needs a lot more tests and quite a bit of work on the cache invalidation logic. While it would certainly be useful to have more efficient access to the space hierarchy, we don't want to return wrong results.

@WilsonLe WilsonLe force-pushed the feature/get-space-hierarchy-cache branch from 27e24e5 to d02c60f Compare November 6, 2024 10:39
@WilsonLe WilsonLe force-pushed the feature/get-space-hierarchy-cache branch from d02c60f to 2962e68 Compare November 6, 2024 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants