-
Notifications
You must be signed in to change notification settings - Fork 20
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
Bug: /project/children endpoint is slow #5199
Labels
Comments
MichaelAkvo
added a commit
that referenced
this issue
Jan 25, 2023
# Counting children This was slow because we made a query for each project. Now we get the children and grand children. A simple dict with each project and a list of their children is then built in python. **Side effect** Paging doesn't work anymore as the queryset includes grand children. Reimplementing it can be done another time if we really do have projects with enormous hierarchies. # Parent retrieval We already know who the parent is since we're getting its children --> no need to make another query. # Locations We weren't retrieving related objects, which we now do. Additionally, we iterated over the list of countries twice when one iteration was enough.
1 task
MichaelAkvo
added a commit
that referenced
this issue
Jan 30, 2023
# Counting children This was slow because we made a query for each project. Now we get the children and grand children. A simple dict with each project and a list of their children is then built in python. **Side effect** Paging doesn't work anymore as the queryset includes grand children. Reimplementing it can be done another time if we really do have projects with enormous hierarchies. # Parent retrieval We already know who the parent is since we're getting its children --> no need to make another query. # Locations We weren't retrieving related objects, which we now do. Additionally, we iterated over the list of countries twice when one iteration was enough.
zuhdil
added a commit
that referenced
this issue
Mar 10, 2023
…t-is-slow [#5199] Optimize /project/children endpoint
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What were you doing?
When accesing the hierarchies view for EUTF Africa, the program has 265 child projects and it takes about 20s to load them all. /project/children is a paged call and has to be called multiple times to get all children. Each call takes bout 2s.
What should've happened?
Each call should really only take a 10s of milliseconds not thousands.
My environment
No response
Additional context
The frontend also doesn't add the projects as they arrive, instead it waits for all calls to complete. Another bug report should probably be created.
The text was updated successfully, but these errors were encountered: