Skip to content
Snippets Groups Projects
Commit 97cc6196 authored by Fabio Castelli's avatar Fabio Castelli
Browse files

fix: reduce the number of subqueries against Packages by preloading the...

fix: reduce the number of subqueries against Packages by preloading the existing dependencies names from AUR
parent 77ef87c8
No related branches found
No related tags found
1 merge request!826Reduce the number of subqueries against Packages
Pipeline #106867 passed
......@@ -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 %}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment