From 7401ae845a91d4c713b00f7cacb3f54a4c0df638 Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Thu, 19 Jan 2023 15:37:35 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20=E6=94=B9=E8=BF=9B=E5=85=B3=E9=97=AD?= =?UTF-8?q?=E7=AC=94=E8=AE=B0=E6=9C=AC=E4=BD=93=E9=AA=8C=20Fix=20https://g?= =?UTF-8?q?ithub.com/siyuan-note/siyuan/issues/7124?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel/model/box.go | 10 +++++++--- kernel/task/queue.go | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/kernel/model/box.go b/kernel/model/box.go index 02ad30924..700cfea57 100644 --- a/kernel/model/box.go +++ b/kernel/model/box.go @@ -353,14 +353,18 @@ func (box *Box) Remove(path string) error { } func (box *Box) Unindex() { + task.PrependTask(task.DatabaseIndex, unindex, box.ID) +} + +func unindex(boxID string) { tx, err := sql.BeginTx() if nil != err { return } - sql.RemoveBoxHash(tx, box.ID) - sql.DeleteByBoxTx(tx, box.ID) + sql.RemoveBoxHash(tx, boxID) + sql.DeleteByBoxTx(tx, boxID) sql.CommitTx(tx) - ids := treenode.RemoveBlockTreesByBoxID(box.ID) + ids := treenode.RemoveBlockTreesByBoxID(boxID) RemoveRecentDoc(ids) } diff --git a/kernel/task/queue.go b/kernel/task/queue.go index 37bd4d092..c0d2850da 100644 --- a/kernel/task/queue.go +++ b/kernel/task/queue.go @@ -101,7 +101,7 @@ const ( CloudSync = "task.cloud.sync" // 数据同步 RepoCheckout = "task.repo.checkout" // 从快照中检出 DatabaseIndexFull = "task.database.index.full" // 重建索引 - DatabaseIndex = "task.database.index" // 数据库所以队列 + DatabaseIndex = "task.database.index" // 数据库索引队列 DatabaseIndexFix = "task.database.index.fix" // 数据库索引订正 OCRImage = "task.ocr.image" // 图片 OCR 提取文本 HistoryGenerateDoc = "task.history.generateDoc" // 生成文件历史