ソースを参照

:art: Automatic check of database indexes is only performed once after startup https://github.com/siyuan-note/siyuan/issues/10563

Daniel 1 年間 前
コミット
aeb09cb0f6
4 ファイル変更4 行追加3 行削除
  1. 0 1
      kernel/job/cron.go
  2. 1 0
      kernel/main.go
  3. 1 0
      kernel/mobile/kernel.go
  4. 2 2
      kernel/model/index_fix.go

+ 0 - 1
kernel/job/cron.go

@@ -38,7 +38,6 @@ func StartCron() {
 	go every(util.SQLFlushInterval, sql.FlushTxJob)
 	go every(util.SQLFlushInterval, sql.FlushTxJob)
 	go every(util.SQLFlushInterval, sql.FlushHistoryTxJob)
 	go every(util.SQLFlushInterval, sql.FlushHistoryTxJob)
 	go every(util.SQLFlushInterval, sql.FlushAssetContentTxJob)
 	go every(util.SQLFlushInterval, sql.FlushAssetContentTxJob)
-	go every(10*time.Minute, model.FixIndexJob)
 	go every(10*time.Minute, model.IndexEmbedBlockJob)
 	go every(10*time.Minute, model.IndexEmbedBlockJob)
 	go every(10*time.Minute, model.CacheVirtualBlockRefJob)
 	go every(10*time.Minute, model.CacheVirtualBlockRefJob)
 	go every(30*time.Second, model.OCRAssetsJob)
 	go every(30*time.Second, model.OCRAssetsJob)

+ 1 - 0
kernel/main.go

@@ -48,6 +48,7 @@ func main() {
 	util.PushClearAllMsg()
 	util.PushClearAllMsg()
 
 
 	job.StartCron()
 	job.StartCron()
+	go model.CheckIndex()
 	go model.AutoGenerateDocHistory()
 	go model.AutoGenerateDocHistory()
 	go cache.LoadAssets()
 	go cache.LoadAssets()
 	go util.CheckFileSysStatus()
 	go util.CheckFileSysStatus()

+ 1 - 0
kernel/mobile/kernel.go

@@ -63,6 +63,7 @@ func StartKernel(container, appDir, workspaceBaseDir, timezoneID, localIPs, lang
 		util.PushClearAllMsg()
 		util.PushClearAllMsg()
 
 
 		job.StartCron()
 		job.StartCron()
+		go model.CheckIndex()
 		go model.AutoGenerateDocHistory()
 		go model.AutoGenerateDocHistory()
 		go cache.LoadAssets()
 		go cache.LoadAssets()
 	}()
 	}()

+ 2 - 2
kernel/model/index_fix.go

@@ -40,8 +40,8 @@ import (
 	"github.com/siyuan-note/siyuan/kernel/util"
 	"github.com/siyuan-note/siyuan/kernel/util"
 )
 )
 
 
-// FixIndexJob 自动校验数据库索引 https://github.com/siyuan-note/siyuan/issues/7016
-func FixIndexJob() {
+// CheckIndex 自动校验数据库索引 https://github.com/siyuan-note/siyuan/issues/7016 https://github.com/siyuan-note/siyuan/issues/10563
+func CheckIndex() {
 	task.AppendTask(task.DatabaseIndexFix, removeDuplicateDatabaseIndex)
 	task.AppendTask(task.DatabaseIndexFix, removeDuplicateDatabaseIndex)
 	sql.WaitForWritingDatabase()
 	sql.WaitForWritingDatabase()