summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorJason Song <i@wolfogre.com>2023-08-17 22:05:17 +0800
committerGitHub <noreply@github.com>2023-08-17 14:05:17 +0000
commit47fddaadc8b4c8d4d4359d6209b9fe06d6387a30 (patch)
tree823e4fd9174e0238a27b5fa1fdb273af68237aff /services
parent940f9975120a8d9e782a457edd5ccf1129ab746a (diff)
downloadgitea-47fddaadc8b4c8d4d4359d6209b9fe06d6387a30.tar.gz
gitea-47fddaadc8b4c8d4d4359d6209b9fe06d6387a30.zip
Support rebuilding issue indexer manually (#26546)
Provide a way to rebuild issue indexer manually. So if the indexer get outdated because of some bugs like #26539, we can rebuild it. <img width="1104" alt="image" src="https://github.com/go-gitea/gitea/assets/9418365/ac242e29-6f04-47ca-b3d0-801a796448d3"> Co-authored-by: Giteabot <teabot@gitea.io>
Diffstat (limited to 'services')
-rw-r--r--services/cron/tasks_extended.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/services/cron/tasks_extended.go b/services/cron/tasks_extended.go
index acf2d3373c..48ea87df7f 100644
--- a/services/cron/tasks_extended.go
+++ b/services/cron/tasks_extended.go
@@ -13,6 +13,7 @@ import (
"code.gitea.io/gitea/models/system"
user_model "code.gitea.io/gitea/models/user"
"code.gitea.io/gitea/modules/git"
+ issue_indexer "code.gitea.io/gitea/modules/indexer/issues"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/updatechecker"
repo_service "code.gitea.io/gitea/services/repository"
@@ -213,6 +214,16 @@ func registerGCLFS() {
})
}
+func registerRebuildIssueIndexer() {
+ RegisterTaskFatal("rebuild_issue_indexer", &BaseConfig{
+ Enabled: false,
+ RunAtStart: false,
+ Schedule: "@annually",
+ }, func(ctx context.Context, _ *user_model.User, config Config) error {
+ return issue_indexer.PopulateIssueIndexer(ctx, false)
+ })
+}
+
func initExtendedTasks() {
registerDeleteInactiveUsers()
registerDeleteRepositoryArchives()
@@ -227,4 +238,5 @@ func initExtendedTasks() {
registerUpdateGiteaChecker()
registerDeleteOldSystemNotices()
registerGCLFS()
+ registerRebuildIssueIndexer()
}