Skip to content

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

:art: 改进关闭笔记本体验 Fix https://github.com/siyuan-note/siyuan/issues/7124

Liang Ding7401ae845a91
diff --git a/kernel/model/box.go b/kernel/model/box.go
index 02ad309245..700cfea57e 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 37bd4d0925..c0d2850da1 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" // 生成文件历史