Skip to content

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

:art: 潜在的文件锁问题 https://github.com/siyuan-note/siyuan/issues/5191

Liang Ding5581397aebaf
diff --git a/kernel/model/sync.go b/kernel/model/sync.go
index a6e9542da2..e4bc139139 100644
--- a/kernel/model/sync.go
+++ b/kernel/model/sync.go
@@ -1078,13 +1078,13 @@ func getWorkspaceDataConf() (conf *filesys.DataConf, err error) {
if !gulu.File.IsExist(confPath) {
os.MkdirAll(filepath.Dir(confPath), 0755)
data, _ := gulu.JSON.MarshalIndentJSON(conf, "", " ")
- if err = os.WriteFile(confPath, data, 0644); nil != err {
+ if err = filelock.NoLockFileWrite(confPath, data); nil != err {
util.LogErrorf("save sync conf [%s] failed: %s", confPath, err)
}
return
}
- data, err := os.ReadFile(confPath)
+ data, err := filelock.NoLockFileRead(confPath)
if nil != err {
util.LogErrorf("read sync conf [%s] failed: %s", confPath, err)
return