gitea/services
Lunny Xiao d21ce9fa07
Improve the performance when detecting the file editable (#34653)
Noticed the SQL will be executed 4 times when visit the file render view
page. For a repository which have many pull requests, it maybe slow.
```SQL
2025/06/08 15:24:44 models/issues/pull_list.go:69:GetUnmergedPullRequestsByHeadInfo() [I] [SQL] SELECT * FROM `pull_request` INNER JOIN `issue` ON issue.id = pull_request.issue_id WHERE (head_repo_id = ? AND head_branch = ? AND has_merged = ? AND issue.is_closed = ? AND flow = ?) [393 main false false 0] - 2.004167ms
2025/06/08 15:24:44 models/issues/pull_list.go:69:GetUnmergedPullRequestsByHeadInfo() [I] [SQL] SELECT * FROM `pull_request` INNER JOIN `issue` ON issue.id = pull_request.issue_id WHERE (head_repo_id = ? AND head_branch = ? AND has_merged = ? AND issue.is_closed = ? AND flow = ?) [393 main false false 0] - 1.03975ms
2025/06/08 15:24:44 models/issues/pull_list.go:69:GetUnmergedPullRequestsByHeadInfo() [I] [SQL] SELECT * FROM `pull_request` INNER JOIN `issue` ON issue.id = pull_request.issue_id WHERE (head_repo_id = ? AND head_branch = ? AND has_merged = ? AND issue.is_closed = ? AND flow = ?) [393 main false false 0] - 881.583µs
2025/06/08 15:24:44 models/issues/pull_list.go:69:GetUnmergedPullRequestsByHeadInfo() [I] [SQL] SELECT * FROM `pull_request` INNER JOIN `issue` ON issue.id = pull_request.issue_id WHERE (head_repo_id = ? AND head_branch = ? AND has_merged = ? AND issue.is_closed = ? AND flow = ?) [393 main false false 0] - 935.084µs
```

This PR did a refactor to query it once only.
2025-06-12 18:12:45 +00:00
..
actions Keeping consistent between UI and API about combined commit status state and fix some bugs (#34562) 2025-06-09 04:05:33 +00:00
agit Option to delay conflict checking of old pull requests until page view (#27779) 2025-04-24 19:26:57 +00:00
asymkey Improve instance wide ssh commit signing (#34341) 2025-06-11 10:32:55 +00:00
attachment Enable testifylint rules (#34075) 2025-03-31 01:53:48 -04:00
auth Fix last admin check when syncing users (#34649) 2025-06-09 20:57:45 +00:00
automerge Option to delay conflict checking of old pull requests until page view (#27779) 2025-04-24 19:26:57 +00:00
context Improve the performance when detecting the file editable (#34653) 2025-06-12 18:12:45 +00:00
contexttest Add API endpoint to request contents of multiple files simultaniously (#34139) 2025-04-22 01:20:11 +08:00
convert Fix pull requests API convert panic when head repository is deleted. (#34685) 2025-06-10 20:19:52 -07:00
cron Use default Git timeout when checking repo health (#33593) 2025-02-14 15:13:56 +00:00
doctor Do not mutate incoming options to SearchRepositoryByName (#34553) 2025-06-02 17:33:25 +00:00
externalaccount Enable addtional linters (#34085) 2025-04-01 10:14:01 +00:00
feed Fix notify watch failure when the content is too long (#34233) 2025-04-20 02:49:57 +00:00
forms Refactor some tests (#34580) 2025-06-03 01:26:19 +00:00
git Fix GetUsersByEmails (#34643) 2025-06-07 18:30:36 +00:00
gitdiff Mark parent directory as viewed when all files are viewed (#33958) 2025-04-15 22:35:22 +08:00
indexer Update issue indexer after merging a PR (#30715) 2024-05-08 14:45:15 +00:00
issue Fix doctor deleting orphaned issues attachments (#34142) 2025-05-30 05:06:03 +00:00
lfs Enable addtional linters (#34085) 2025-04-01 10:14:01 +00:00
mailer Enable addtional linters (#34085) 2025-04-01 10:14:01 +00:00
markup Refactor Git Attribute & performance optimization (#34154) 2025-04-11 21:41:29 +08:00
migrations Fix missed merge commit sha and time when migrating from codecommit (#34645) 2025-06-08 16:16:23 +00:00
mirror Only git operations should update `last changed` of a repository (#34388) 2025-05-11 19:18:46 +00:00
notify Add workflow_job webhook (#33694) 2025-03-11 10:40:38 -07:00
oauth2_provider Refactor FindOrgOptions to use enum instead of bool, fix membership visibility (#34629) 2025-06-09 03:30:34 +00:00
org Fix remove org user failure on mssql (#34449) 2025-05-14 02:33:56 +08:00
packages Fix package upload temp path (#34196) 2025-04-14 18:55:02 +08:00
projects Enable addtional linters (#34085) 2025-04-01 10:14:01 +00:00
pull Improve instance wide ssh commit signing (#34341) 2025-06-11 10:32:55 +00:00
release Enable testifylint rules (#34075) 2025-03-31 01:53:48 -04:00
repository Improve instance wide ssh commit signing (#34341) 2025-06-11 10:32:55 +00:00
secrets Added Description Field for Secrets and Variables (#33526) 2025-03-17 19:24:54 +00:00
task Fix bug when migrating repository (#34182) 2025-04-14 04:48:03 +00:00
uinotification Penultimate round of `db.DefaultContext` refactor (#27414) 2023-10-11 04:24:07 +00:00
user Fix last admin check when syncing users (#34649) 2025-06-09 20:57:45 +00:00
versioned_migration Add global lock for migrations to make upgrade more safe with multiple replications (#33706) 2025-03-07 21:08:53 +00:00
webhook Refactor some tests (#34580) 2025-06-03 01:26:19 +00:00
webtheme Improve theme display (#30671) 2025-03-08 21:38:11 +00:00
wiki Improve instance wide ssh commit signing (#34341) 2025-06-11 10:32:55 +00:00