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

Add prefetch/cache/async load for builds on project dashboard #61

Closed
agjohnson opened this issue Nov 17, 2021 · 1 comment · Fixed by readthedocs/readthedocs.org#11613
Assignees
Labels
Accepted Accepted issue on our roadmap Feature New feature

Comments

@agjohnson
Copy link
Contributor

Add prefetch build to project dashboard project list queryset

@agjohnson
Copy link
Contributor Author

The base queryset used by the view/filter already has prefetch, it's the model methods that are sporadic in usage of prefetching.

Specifically, I was trying to improve the query performance in #463 and found that Project.has_good_build avoids the prefetch from Project.objects.dashboard(user). I replaced this with Project.get_latest_build and the extra queries were removed, but this logic is slightly different.

@agjohnson agjohnson self-assigned this Sep 23, 2024
agjohnson added a commit that referenced this issue Sep 23, 2024
Along with a model prefetch change in the view, this reduces the number
of queries by 90 queries, from 132 to 42. This:

- Uses prefetchs build for `latest_build` to avoid multiple lookups on `Version.build`
- Retains usage of a prefetched `project` on Version
- Swaps some permission check logic to only perform additional user queries on private versions
- Passes a project object into the build chip to avoid a lookup on `Build.project.*`

- Refs #61
- Fixes #463
humitos pushed a commit that referenced this issue Sep 25, 2024
* Template optimizations on version listing

Along with a model prefetch change in the view, this reduces the number
of queries by 90 queries, from 132 to 42. This:

- Uses prefetchs build for `latest_build` to avoid multiple lookups on `Version.build`
- Retains usage of a prefetched `project` on Version
- Swaps some permission check logic to only perform additional user queries on private versions
- Passes a project object into the build chip to avoid a lookup on `Build.project.*`

- Refs #61
- Fixes #463

* Lint

* Call build chip the same way in project listing

* Fix variable passed into chip
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Accepted Accepted issue on our roadmap Feature New feature
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant