Browse Source

:art: 改进内核任务调度机制提升稳定性 https://github.com/siyuan-note/siyuan/issues/7113

Liang Ding 2 years ago
parent
commit
0da0fb6712
2 changed files with 4 additions and 2 deletions
  1. 2 1
      kernel/model/history.go
  2. 2 1
      kernel/task/queue.go

+ 2 - 1
kernel/model/history.go

@@ -38,6 +38,7 @@ import (
 	"github.com/siyuan-note/siyuan/kernel/conf"
 	"github.com/siyuan-note/siyuan/kernel/search"
 	"github.com/siyuan-note/siyuan/kernel/sql"
+	"github.com/siyuan-note/siyuan/kernel/task"
 	"github.com/siyuan-note/siyuan/kernel/treenode"
 	"github.com/siyuan-note/siyuan/kernel/util"
 )
@@ -48,7 +49,7 @@ func AutoGenerateDocHistory() {
 	ChangeHistoryTick(Conf.Editor.GenerateHistoryInterval)
 	for {
 		<-historyTicker.C
-		generateDocHistory()
+		task.PrependTask(task.HistoryGenerateDoc, generateDocHistory)
 	}
 }
 

+ 2 - 1
kernel/task/queue.go

@@ -104,7 +104,8 @@ const (
 	DatabaseIndex           = "task.database.index"            // 数据库所以队列
 	DatabaseIndexFix        = "task.database.index.fix"        // 数据库索引订正
 	OCRImage                = "task.ocr.image"                 // 图片 OCR 提取文本
-	DatabaseIndexEmbedBlock = "task.database.index.embedblock" // 数据库索引嵌入块
+	HistoryGenerateDoc      = "task.history.generateDoc"       // 生成文件历史
+	DatabaseIndexEmbedBlock = "task.database.index.embedBlock" // 数据库索引嵌入块
 )
 
 func Loop() {