Open
Conversation
tdethier
requested changes
Mar 19, 2026
Member
tdethier
left a comment
There was a problem hiding this comment.
So, I ran the setuper locally with and without this PR in order to compare results - there was a slight improvement:
Without this PR:
With this PR:
But there are still a lot of duplicated queries in multiple calls, which is something we can probably improve. When looking at random times, I still see very long queries, such as
- updating the default picture of an org unit
- other random calls (sorry I did not check what the setuper was doing at that moment)
- this one is way too long, 2 seconds for a GET on org unit types is crazy:
- PATCH on that endpoint is long as well:
forms and sync might be too old/difficult to fix, but I'm hoping to improve at least org unit types and profiles
Comment on lines
+773
to
+779
| requested_fields = request.query_params.get("fields") | ||
| if requested_fields: | ||
| serializer = OrgUnitSearchSerializer( | ||
| org_unit, fields=requested_fields.split(","), context={"request": request} | ||
| ) | ||
| return Response(serializer.data) | ||
|
|
Member
There was a problem hiding this comment.
Could you please add a unit test to make sure that you receive only the requested fields as a result of a PATCH?
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.
What problem is this PR solving?
The setuper was slow. This PR is about proposing a fix for that.
Related JIRA tickets
IA-4458
Changes
iaso/api/org_units.pyHow to test
Print screen / video
Notes
Things that the reviewers should know:
Doc
Tell us where the doc can be found (docs folder, wiki, in the code...).