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 · 2 comments
Open

Objecten API: Permission admin view is slow #464

alextreme opened this issue Oct 1, 2024 · 2 comments
Assignees
Labels
bug Something isn't working owner: den haag triage

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working owner: den haag triage
Projects
Status: Triage
Development

No branches or pull requests

3 participants