mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
fix: reduce the number of subqueries against Packages by preloading the existing dependencies names from AUR
This commit is contained in:
parent
77ef87c882
commit
97cc6196eb
2 changed files with 12 additions and 1 deletions
|
@ -190,6 +190,17 @@ async def package(
|
|||
if not all_deps:
|
||||
deps = deps.limit(max_listing)
|
||||
context["dependencies"] = deps.all()
|
||||
# Existing dependencies to avoid multiple lookups
|
||||
context["dependencies_names_from_aur"] = [
|
||||
item.Name
|
||||
for item in db.query(models.Package)
|
||||
.filter(
|
||||
models.Package.Name.in_(
|
||||
pkg.package_dependencies.with_entities(models.PackageDependency.DepName)
|
||||
)
|
||||
)
|
||||
.all()
|
||||
]
|
||||
|
||||
# Package requirements (other packages depend on this one).
|
||||
reqs = pkgutil.pkg_required(pkg.Name, [p.RelName for p in rels_data.get("p", [])])
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
{% endif %}
|
||||
{% else -%}
|
||||
</a>
|
||||
{%- if dep.is_aur_package() -%}
|
||||
{%- if dep.DepName in dependencies_names_from_aur -%}
|
||||
<sup><small>AUR</small></sup>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
|
Loading…
Add table
Reference in a new issue