An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: 改进无法读写块树文件后的处理 Fix https://github.com/siyuan-note/siyuan/issues/5619
Liang Dingb10a7d99f8d8
diff --git a/app/electron/main.js b/app/electron/main.jsindex 43c5346ee0..eb0ae9fe0c 100644--- a/app/electron/main.js+++ b/app/electron/main.js@@ -529,7 +529,7 @@ const initKernel = (initData) => {breakcase 23:showErrorWindow('⚠️ 无法读写块树文件 Failed to access blocktree file',- `<div>块树文件正在被其他程序锁定。如果你使用了第三方同步盘,请在思源运行期间关闭同步。</div><div>The block tree file is being locked by another program. If you use a third-party sync disk, please turn off the sync while SiYuan is running.</div>`)+ `<div>块树文件正在被其他程序锁定或者已经损坏,请删除 工作空间/temp/ 文件夹后重启</div><div>The block tree file is being locked by another program or is damaged, please delete the workspace/temp/ folder and restart.</div>`)breakcase 0:case 1: // Fatal errordiff --git a/kernel/model/conf.go b/kernel/model/conf.goindex 1a308f250a..e0880c71c3 100644--- a/kernel/model/conf.go+++ b/kernel/model/conf.go@@ -510,9 +510,8 @@ func InitBoxes() {}for _, box := range Conf.GetOpenedBoxes() {- box.UpdateHistoryGenerated() // 初始化历史生成时间为当前时间if !initialized {- box.BootIndex()+ box.Index(true)}ListDocTree(box.ID, "/", Conf.FileTree.Sort) // 缓存根一级的文档树展开diff --git a/kernel/model/index.go b/kernel/model/index.goindex 18e245b457..6ecf9b96ec 100644--- a/kernel/model/index.go+++ b/kernel/model/index.go@@ -40,44 +40,6 @@ import ("github.com/siyuan-note/siyuan/kernel/util")-func (box *Box) BootIndex() {- util.SetBootDetails("Listing files...")- files := box.ListFiles("/")- boxLen := len(Conf.GetOpenedBoxes())- if 1 > boxLen {- boxLen = 1- }- bootProgressPart := 10.0 / float64(boxLen) / float64(len(files))-- luteEngine := NewLute()- i := 0- // 读取并缓存路径映射- for _, file := range files {- if file.isdir || !strings.HasSuffix(file.name, ".sy") {- continue- }-- p := file.path- tree, err := filesys.LoadTree(box.ID, p, luteEngine)- if nil != err {- logging.LogErrorf("read box [%s] tree [%s] failed: %s", box.ID, p, err)- continue- }-- docIAL := parse.IAL2MapUnEsc(tree.Root.KramdownIAL)- cache.PutDocIAL(p, docIAL)-- util.IncBootProgress(bootProgressPart, "Parsing tree "+util.ShortPathForBootingDisplay(tree.Path))- // 缓存块树- treenode.IndexBlockTree(tree)- if 1 < i && 0 == i%64 {- filelock.ReleaseAllFileLocks()- }- i++- }- return-}-func (box *Box) Index(fullRebuildIndex bool) (treeCount int, treeSize int64) {defer debug.FreeOSMemory()