run withDescendents with filters#8014
Merged
Merged
Conversation
filfreire
previously approved these changes
Sep 26, 2024
jackkav
commented
Sep 27, 2024
Comment on lines
+159
to
+161
| const modelTypesWithinFolders = [models.request.type, models.grpcRequest.type, models.webSocketRequest.type]; | ||
| const typeFilter = modelTypesWithinFolders.includes(type) ? [models.requestGroup.type, type] : [type]; | ||
| const children = await db.withDescendants(workspace, null, typeFilter); |
Contributor
Author
There was a problem hiding this comment.
perhaps consider an excludive option here isntead, eg [models.ApiSepc.type]
ihexxa
approved these changes
Sep 30, 2024
a6660ad to
9c51e84
Compare
Contributor
Author
|
Related: INS-4503 |
Contributor
|
If we want to get all requests in a workspace, It's unintuitive that we need to pass [requestGroup, request] as the queryTypes argument to withDescendants and then filter out the requestGroups from result. Maybe we can do it within withDescendants method. |
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
motivation: large git sync collection block the main event loops by running withDescentants 15 times on each tab navigation
rather than fetching all descendants 15 times
we just fetch the types we need, the problem is we need to also fetch all the folders
ideas:
1a. just read and write to files and not a fake filestore-nedb adapter
2a. run this in a different conetxt so it doesn't need to be re-evaluated on navigation.
2b. run it faster by fetching a list of all folders in a workspace and iterations over the types using an $in query
Related: INS-4503