mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-30 15:43:52 +03:00
Stop hanging issue indexer initialisation from preventing shutdown (#10243)
Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: Antoine GIRARD <sapk@users.noreply.github.com>
This commit is contained in:
parent
6c823c7560
commit
1125d1453b
1 changed files with 15 additions and 17 deletions
|
@ -143,7 +143,6 @@ func InitIssueIndexer(syncReindex bool) {
|
||||||
var populate bool
|
var populate bool
|
||||||
switch setting.Indexer.IssueType {
|
switch setting.Indexer.IssueType {
|
||||||
case "bleve":
|
case "bleve":
|
||||||
graceful.GetManager().RunWithShutdownFns(func(_, atTerminate func(context.Context, func())) {
|
|
||||||
issueIndexer := NewBleveIndexer(setting.Indexer.IssuePath)
|
issueIndexer := NewBleveIndexer(setting.Indexer.IssuePath)
|
||||||
exist, err := issueIndexer.Init()
|
exist, err := issueIndexer.Init()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -152,7 +151,7 @@ func InitIssueIndexer(syncReindex bool) {
|
||||||
}
|
}
|
||||||
populate = !exist
|
populate = !exist
|
||||||
holder.set(issueIndexer)
|
holder.set(issueIndexer)
|
||||||
atTerminate(context.Background(), func() {
|
graceful.GetManager().RunAtTerminate(context.Background(), func() {
|
||||||
log.Debug("Closing issue indexer")
|
log.Debug("Closing issue indexer")
|
||||||
issueIndexer := holder.get()
|
issueIndexer := holder.get()
|
||||||
if issueIndexer != nil {
|
if issueIndexer != nil {
|
||||||
|
@ -161,7 +160,6 @@ func InitIssueIndexer(syncReindex bool) {
|
||||||
log.Info("PID: %d Issue Indexer closed", os.Getpid())
|
log.Info("PID: %d Issue Indexer closed", os.Getpid())
|
||||||
})
|
})
|
||||||
log.Debug("Created Bleve Indexer")
|
log.Debug("Created Bleve Indexer")
|
||||||
})
|
|
||||||
case "db":
|
case "db":
|
||||||
issueIndexer := &DBIndexer{}
|
issueIndexer := &DBIndexer{}
|
||||||
holder.set(issueIndexer)
|
holder.set(issueIndexer)
|
||||||
|
|
Loading…
Reference in a new issue