mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-10-31 22:58:59 +01:00
0d029ebe6d
When a logged in user with no repositories visits their dashboard, it will display a search box that lists their own repositories. This is served by the `repo.SearchRepos` handler, which in turn calls `commitstatus_service.FindReposLastestCommitStatuses()` with an empty repo list. That, in turn, will call `git_model.FindBranchesByRepoAndBranchName()`, with an empty map. With no map, `FindBranchesByRepoAndBranchName()` ends up querying the entire `branch` table, because no conditions were set up. Armed with a gazillion repo & commit shas, we return to `FindReposLastestCommitStatuses`, and promptly call `git_model.GetLatestCommitStatusForPairs`, which constructs a monstrous query with so many placeholders that the database tells us to go somewhere else, and flips us off. At least on instances the size of Codeberg. On smaller instances, it will eventually return, and throw away all the data, and return an empty set, having performed all this for naught. We fix this by short-circuiting `FindBranchesByRepoAndBranchName`, and returning fast if our inputs are empty. A test case is included. Fixes #3521. Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu> |
||
---|---|---|
.. | ||
actions | ||
activities | ||
admin | ||
asymkey | ||
auth | ||
avatars | ||
db | ||
dbfs | ||
fixtures | ||
forgejo/semver | ||
forgejo_migrations | ||
git | ||
issues | ||
migrations | ||
organization | ||
packages | ||
perm | ||
project | ||
pull | ||
repo | ||
secret | ||
shared/types | ||
system | ||
unit | ||
unittest | ||
user | ||
webhook | ||
error.go | ||
fixture_generation.go | ||
fixture_test.go | ||
main_test.go | ||
org.go | ||
org_team.go | ||
org_team_test.go | ||
org_test.go | ||
repo.go | ||
repo_test.go | ||
repo_transfer.go | ||
repo_transfer_test.go |