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

Objecten API: Permission admin view is slow #464

Open
alextreme opened this issue Oct 1, 2024 · 11 comments · May be fixed by #508
Open

Objecten API: Permission admin view is slow #464

alextreme opened this issue Oct 1, 2024 · 11 comments · May be fixed by #508
Assignees
Labels
approved bug Something isn't working owner: den haag

Comments

@alextreme
Copy link
Member

Product versie / Product version

2.4.4

Omschrijf het probleem / Describe the bug

Taiga DH 596

Adding a new permission in the Objects API for DH currently takes ~12 seconds, this because of the retrieval of all the objecttypes on every pageload.

For further details and an APM trace please see the Taiga issue

Stappen om te reproduceren / Steps to reproduce

No response

Verwacht gedrag / Expected behavior

No response

@joeribekker
Copy link
Member

W're doing an initial analysis before estimating (1-2 hours).
Please put back the ticket in triage with the analysis.

@annashamray
Copy link
Collaborator

Analysis:
What happens

This happens because of field-based authorization option. On this page if you check "Use field-based authorization", then all fields of all versions of the selected objecttype would be displayed.
So under the hood each of the objecttypes is requested in this method:

def get_data_field_choices(self):

We can't use LIST objecttypes endpoint, because it doesn't have version data, so we use /api/v2/objecttypes/{objecttype_uuid}/versions endpoint for each objecttype uuid.

How to improve it

  1. Now we request all objecttypes before the page is loaded, even if only one would be eventually selected.
    Perhaps we can just request a particular objecttype which is selected in the form. So there should be required some React coding, like having an internal rest endpoint which FE requests which has objecttype id as a parameter.

  2. If field-based auth is not used it can be turned off globally (for example via env var), and this problem would be solved very easily.

@annashamray annashamray moved this from In Progress to Triage in Data en API fundament Oct 29, 2024
@joeribekker
Copy link
Member

So, only load in objecttype details when: 1) an objecttype is selected and 2) field based auth is checked. Only then load in the field based permission checkboxes.

Estimated: 3 days

@joeribekker joeribekker moved this from Triage to Waiting for approval in Data en API fundament Dec 17, 2024
@joeribekker
Copy link
Member

@PeterVanBragt approval needed

@PeterVanBragt
Copy link

How can I tag Jan Verbeek in this ticket? I would like him to check the business value against the costs for resolving (and check with him if there's a sponsor for this).

@alextreme
Copy link
Member Author

Dit kan met @VerbeekIT als het goed is

@PeterVanBragt
Copy link

@VerbeekIT - Checking the business value against the costs for resolving - what do you think? And do you know a sponsor for this?

@VerbeekIT
Copy link

Ja dat lukt via VerbeekIT

@PeterVanBragt
Copy link

So, what exactly can be expected (performance wise) for this 3 day investment? Will 12 seconds become less then one?

@alextreme
Copy link
Member Author

It will be less than 3 seconds to load the page, and most likely quicker

@PeterVanBragt
Copy link

Ok, approved (for max 3 day development time)

@joeribekker joeribekker moved this from Waiting for approval to Todo in Data en API fundament Dec 23, 2024
@danielmursa-dev danielmursa-dev moved this from Todo to In Progress in Data en API fundament Dec 30, 2024
danielmursa-dev added a commit that referenced this issue Dec 31, 2024
danielmursa-dev added a commit that referenced this issue Dec 31, 2024
@danielmursa-dev danielmursa-dev linked a pull request Dec 31, 2024 that will close this issue
@danielmursa-dev danielmursa-dev moved this from In Progress to Implemented in Data en API fundament Dec 31, 2024
danielmursa-dev added a commit that referenced this issue Jan 2, 2025
danielmursa-dev added a commit that referenced this issue Jan 2, 2025
danielmursa-dev added a commit that referenced this issue Jan 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved bug Something isn't working owner: den haag
Projects
Status: Implemented
Development

Successfully merging a pull request may close this issue.

6 participants