package details view - optimise co-maintainers queries
context["comaintainers"] = [
c.User
for c in pkgbase.comaintainers.order_by(
PackageComaintainer.Priority.asc()
).all()
]
It seems that we fetch users one by one which causes O(n) queries while this can be done in one query.
This pattern exists in other places of the codebase as well:
Notable:
context["comaintainers"] = [c.User.Username for c in pkgbase.comaintainers]
This isn't performance critical code but still nice to fetch only the Username.
Edited by Jelle van der Waa