mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
fix: occasional errors when loading package details
Fixes errors that might occur when loading the package details page. Problem: We are querying a list of "Required by" packages. This list is loaded with all details for a "PackageDependency" record. Now we also have a reference to some attributes from the related package (PackageDependency.Package.xxx) This will effectively trigger the ORM to run another query (lazyload), to fetch the missing Package data (for each PackageDependency record). At that point it might have happened that a referenced package got deleted / updated so that we can't retrieve this data anymore and our dep.Package object is "None" Fix: We can force our query to include Package data right away. Thus we can avoid running a separate query (per "required by"...) As a side-effect we get better performance. Signed-off-by: moson-mo <mo-son@mailbox.org>
This commit is contained in:
parent
6c9be9eb97
commit
becce1aac4
2 changed files with 21 additions and 0 deletions
|
@ -217,6 +217,7 @@ def pkg_required(pkgname: str, provides: list[str]) -> list[PackageDependency]:
|
|||
query = (
|
||||
db.query(PackageDependency)
|
||||
.join(Package)
|
||||
.options(orm.contains_eager(PackageDependency.Package))
|
||||
.filter(PackageDependency.DepName.in_(targets))
|
||||
.order_by(Package.Name.asc())
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue