From 23df378a328d46eef179c78df6df82ac4162b991 Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Sat, 28 Jan 2023 16:16:24 +0800 Subject: [PATCH] =?UTF-8?q?:recycle:=20=E6=94=B9=E8=BF=9B=E5=90=8E?= =?UTF-8?q?=E5=8F=B0=E4=BB=BB=E5=8A=A1=E5=88=A4=E6=96=AD=E9=87=8D=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel/model/tree.go | 2 +- kernel/task/queue.go | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/kernel/model/tree.go b/kernel/model/tree.go index 2fa88fc67..2f7d53a9e 100644 --- a/kernel/model/tree.go +++ b/kernel/model/tree.go @@ -157,7 +157,7 @@ func loadTreeByBlockID(id string) (ret *parse.Tree, err error) { bt := treenode.GetBlockTree(id) if nil == bt { - if task.ContainIndexTask() { + if task.ContainIndexTask(task.DatabaseIndex, task.DatabaseIndexFull) { err = ErrIndexing return } diff --git a/kernel/task/queue.go b/kernel/task/queue.go index df5536341..a9731a7ac 100644 --- a/kernel/task/queue.go +++ b/kernel/task/queue.go @@ -18,12 +18,13 @@ package task import ( "context" - "github.com/siyuan-note/siyuan/kernel/util" "reflect" "sync" "time" + "github.com/88250/gulu" "github.com/siyuan-note/logging" + "github.com/siyuan-note/siyuan/kernel/util" ) var ( @@ -84,9 +85,12 @@ const ( ReloadUI = "task.reload.ui" // 重载 UI ) -func ContainIndexTask() bool { +func ContainIndexTask(action string, moreActions ...string) bool { + actions := append(moreActions, action) + actions = gulu.Str.RemoveDuplicatedElem(actions) + for _, task := range taskQueue { - if DatabaseIndex == task.Action || DatabaseIndexFull == task.Action { + if gulu.Str.Contains(task.Action, actions) { return true } }