/pkgbase/$pkgname/voters does a SQL query for every voter
This page is behind log-in so this isn't too critical but this shows an issue with backref, if a package has 60 votes we execute this query 60 times:
fastapi-1 | 2024-08-09 15:57:40,620 INFO sqlalchemy.engine.Engine SELECT `Users`.`ID` AS `Users_ID`, `Users`.`AccountTypeID` AS `Users_AccountTypeID`, `Users`.`Suspended` AS `Users_Suspended`, `Users`.`Username` AS `Users_Username`, `Users`.`Email` AS `Users_Email`, `Users`.`BackupEmail` AS `Users_BackupEmail`, `Users`.`HideEmail` AS `Users_HideEmail`, `Users`.`Passwd` AS `Users_Passwd`, `Users`.`Salt` AS `Users_Salt`, `Users`.`ResetKey` AS `Users_ResetKey`, `Users`.`RealName` AS `Users_RealName`, `Users`.`LangPreference` AS `Users_LangPreference`, `Users`.`Timezone` AS `Users_Timezone`, `Users`.`Homepage` AS `Users_Homepage`, `Users`.`IRCNick` AS `Users_IRCNick`, `Users`.`PGPKey` AS `Users_PGPKey`, `Users`.`LastLogin` AS `Users_LastLogin`, `Users`.`LastLoginIPAddress` AS `Users_LastLoginIPAddress`, `Users`.`LastSSHLogin` AS `Users_LastSSHLogin`, `Users`.`LastSSHLoginIPAddress` AS `Users_LastSSHLoginIPAddress`, `Users`.`InactivityTS` AS `Users_InactivityTS`, `Users`.`RegistrationTS` AS `Users_RegistrationTS`, `Users`.`CommentNotify` AS `Users_CommentNotify`, `Users`.`UpdateNotify` AS `Users_UpdateNotify`, `Users`.`OwnershipNotify` AS `Users_OwnershipNotify`, `Users`.`SSOAccountID` AS `Users_SSOAccountID`, `Users`.`HideDeletedComments` AS `Users_HideDeletedComments`
fastapi-1 | FROM `Users`
fastapi-1 | WHERE `Users`.`ID` = %s
fastapi-1 | 2024-08-09 15:57:40,620 INFO sqlalchemy.engine.Engine [cached since 0.03605s ago] (91685,)
Instead of writing pgkgbase.packages_vote write one query to obtain the Username who voted with a select. This
- Saves 59 queries
- Saves sending unrequired data by just selecting the data we need
Edited by Jelle van der Waa