Skip to content

fix: occasional errors when loading package details

Mario Oenning requested to merge moson/aurweb:fix-package-loading into master

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.


Draft: Still trying to find a proper way to write a test for this.

Signed-off-by: moson-mo mo-son@mailbox.org

Merge request reports