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

Optimize dandiset owner PUT endpoint #1737

Merged
merged 4 commits into from
Nov 21, 2023
Merged

Conversation

mvandenburgh
Copy link
Member

Now that django-allauth uses a regular JSONField for SocialAccount.extra_data, we can optimize the dandisets owner PUT endpoint to be more efficient and do less SQL queries. See release notes for allauth here https://github.com/pennersr/django-allauth/blob/main/ChangeLog.rst#0580-2023-10-26

jjnesbitt
jjnesbitt previously approved these changes Nov 6, 2023
Copy link
Member

@jjnesbitt jjnesbitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mvandenburgh
Copy link
Member Author

Looking at this again, the original ORM expression I wrote can be simplified - see 5cb05e6. I tested it and it works just as well as the previous query.

@jjnesbitt
Copy link
Member

jjnesbitt commented Nov 7, 2023

@mvandenburgh I noticed that we're still calling the get_user_or_400 query n many times, which can be avoided. I pushed 28f0dca which does it in one query (two if you include the count check). It also removes the check about the empty owners list, since I'm not even sure how that could be triggered (a 400 would be raised before that in any case).

Let me know what you think. Sorry for the trampling, it wasn't possible to achieve the whole diff with github suggestions.


Update I've fixed the tests and linting, sorry about that. All should be good now.

Now that django-allauth uses a regular JSONField for
`SocialAccount.extra_data`, we can optimize the dandisets owner query.
@mvandenburgh mvandenburgh merged commit eb839f5 into master Nov 21, 2023
10 checks passed
@mvandenburgh mvandenburgh deleted the socialaccount-jsonfield branch November 21, 2023 19:09
@dandibot
Copy link
Member

🚀 PR was released in v0.3.64 🚀

@dandibot dandibot added the released This issue/pull request has been released. label Nov 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released This issue/pull request has been released.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants