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

This commit is contained in:
Liang Ding 2023-01-25 22:08:21 +08:00
parent e782e034cc
commit 07abcd0121
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
9 changed files with 15 additions and 18 deletions

View file

@ -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",

View file

@ -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",

View file

@ -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",

View file

@ -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": "索引校驗完畢"
}
},
}

View file

@ -942,7 +942,7 @@
"53": "数据同步尚未启用",
"54": "正在索引引用关系...",
"55": "已完成索引 [%d] 篇文档的引用关系",
"56": "TODO",
"56": "正在重建索引,请等重建索引完毕后再尝试打开该文档",
"57": "创建临时密钥失败",
"58": "重建索引完毕,稍后将自动刷新界面...",
"59": "设置同步忽略列表失败",

View file

@ -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"]

View file

@ -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

View file

@ -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) {

View file

@ -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()
}