Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

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

Liang Ding07abcd0121d3
diff --git a/app/appearance/langs/en_US.json b/app/appearance/langs/en_US.json
index cb5e33a486..5f05d325c3 100644
--- a/app/appearance/langs/en_US.json
+++ b/app/appearance/langs/en_US.json
@@ -942,7 +942,7 @@
"53": "Data synchronization has not been enabled",
"54": "Indexing references...",
"55": "Indexed references of [%d] documents",
- "56": "TODO",
+ "56": "Reindexing, please wait until rebuilding is complete before trying to open the document",
"57": "Failed to create temp key",
"58": "After the index is rebuilt, the interface will be automatically refreshed later...",
"59": "Failed to set sync ignore list",
diff --git a/app/appearance/langs/es_ES.json b/app/appearance/langs/es_ES.json
index ca94c3a2f5..8625038abb 100644
--- a/app/appearance/langs/es_ES.json
+++ b/app/appearance/langs/es_ES.json
@@ -942,7 +942,7 @@
"53": "No se ha habilitado la sincronizacion de datos",
"54": "Indexando referencias...",
"55": "Referencias indexadas de [%d] documentos",
- "56": "TODO",
+ "56": "Reindexando, espere hasta que se complete la reconstrucción antes de intentar abrir el documento",
"57": "Fallo en la creación de la clave temporal",
"58": "Después de reconstruir el índice, la interfaz se actualizará automáticamente más tarde...",
"59": " Falló la configuración de sincronización de la lista de ignorados",
diff --git a/app/appearance/langs/fr_FR.json b/app/appearance/langs/fr_FR.json
index 1bcf4e4ec3..26e3bdef46 100644
--- a/app/appearance/langs/fr_FR.json
+++ b/app/appearance/langs/fr_FR.json
@@ -942,7 +942,7 @@
"53": "La synchronisation des données n'a pas été activée",
"54": "Indexation des références...",
"55": "Références indexées de [%d] documents",
- "56": "TODO",
+ "56": "Réindexation, veuillez attendre que la reconstruction soit terminée avant d'essayer d'ouvrir le document",
"57": "Échec de la création d'une clé temporaire",
"58": "Une fois l'index reconstruit, l'interface sera automatiquement rafraîchie ultérieurement...",
"59": "Échec de la définition de la liste des ignores de synchronisation",
diff --git a/app/appearance/langs/zh_CHT.json b/app/appearance/langs/zh_CHT.json
index 794698103f..89209bc97d 100644
--- a/app/appearance/langs/zh_CHT.json
+++ b/app/appearance/langs/zh_CHT.json
@@ -942,7 +942,7 @@
"53": "數據同步尚未啟用",
"54": "正在索引引用關係...",
"55": "已完成索引 [%d] 篇文檔的引用關係",
- "56": "TODO",
+ "56": "正在重建索引,請等重建索引完畢後再嘗試打開該文檔",
"57": "創建臨時金鑰失敗",
"58": "重建索引完畢,稍後將自動重新整理介面...",
"59": "設置同步忽略列表失敗",
@@ -1073,4 +1073,4 @@
"184": "由<a href=\"https://b3log.org/siyuan\" target=\"_blank\">思源筆記</a>強力驅動",
"185": "索引校驗完畢"
}
-},
+}
\ No newline at end of file
diff --git a/app/appearance/langs/zh_CN.json b/app/appearance/langs/zh_CN.json
index e937780ff6..ef6da8ce03 100644
--- a/app/appearance/langs/zh_CN.json
+++ b/app/appearance/langs/zh_CN.json
@@ -942,7 +942,7 @@
"53": "数据同步尚未启用",
"54": "正在索引引用关系...",
"55": "已完成索引 [%d] 篇文档的引用关系",
- "56": "TODO",
+ "56": "正在重建索引,请等重建索引完毕后再尝试打开该文档",
"57": "创建临时密钥失败",
"58": "重建索引完毕,稍后将自动刷新界面...",
"59": "设置同步忽略列表失败",
diff --git a/kernel/api/block.go b/kernel/api/block.go
index e355c3b85c..8c01f06f98 100644
--- a/kernel/api/block.go
+++ b/kernel/api/block.go
@@ -175,8 +175,8 @@ func checkBlockExist(c *gin.Context) {
return
}
if errors.Is(err, model.ErrIndexing) {
- ret.Code = 3
- ret.Data = id
+ ret.Code = 0
+ ret.Data = false
return
}
ret.Data = nil != b
@@ -384,7 +384,7 @@ func getBlockInfo(c *gin.Context) {
}
if errors.Is(err, model.ErrIndexing) {
ret.Code = 3
- ret.Data = id
+ ret.Msg = model.Conf.Language(56)
return
}
if nil == block {
@@ -415,7 +415,7 @@ func getBlockInfo(c *gin.Context) {
}
if errors.Is(err, model.ErrIndexing) {
ret.Code = 3
- ret.Data = id
+ ret.Data = model.Conf.Language(56)
return
}
rootTitle := root.IAL["title"]
diff --git a/kernel/model/block.go b/kernel/model/block.go
index 491f1f8da1..650e7f7b4a 100644
--- a/kernel/model/block.go
+++ b/kernel/model/block.go
@@ -393,7 +393,7 @@ func getBlock(id string) (ret *Block, err error) {
tree, err := loadTreeByBlockID(id)
if nil != err {
- if indexing {
+ if isIndexing() {
err = ErrIndexing
}
return
diff --git a/kernel/model/index.go b/kernel/model/index.go
index 4389311ad2..e664933b7a 100644
--- a/kernel/model/index.go
+++ b/kernel/model/index.go
@@ -54,10 +54,12 @@ func (box *Box) Index() {
var indexing = false
-func waitForIndexing() {
- for indexing {
+func isIndexing() (ret bool) {
+ for i := 0; indexing || i > 7; i++ {
time.Sleep(time.Millisecond * 100)
+ ret = true
}
+ return
}
func index(boxID string) {
diff --git a/kernel/task/queue.go b/kernel/task/queue.go
index 1a5be57884..f4741c7413 100644
--- a/kernel/task/queue.go
+++ b/kernel/task/queue.go
@@ -144,8 +144,6 @@ func StatusLoop() {
}
}
-var taskWaitGroup = sync.WaitGroup{}
-
func Loop() {
for {
time.Sleep(10 * time.Millisecond)
@@ -163,9 +161,7 @@ func Loop() {
break
}
- taskWaitGroup.Add(1)
go execTask(task)
- taskWaitGroup.Wait()
}
}
@@ -202,5 +198,4 @@ func execTask(task *Task) {
}
task.Handler.Call(args)
- taskWaitGroup.Done()
}