🎨 细化云端同步锁提升稳定性 https://github.com/siyuan-note/siyuan/issues/5887

This commit is contained in:
Liang Ding 2022-09-17 22:56:02 +08:00
parent 3468fb0976
commit 9ab7030a81
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
10 changed files with 50 additions and 41 deletions

View file

@ -238,7 +238,7 @@ func RollbackDocHistory(boxID, historyPath string) (err error) {
}
WaitForWritingFiles()
util.WritingFileLock.Lock()
util.LockWriteFile()
srcPath := historyPath
var destPath string
@ -249,22 +249,22 @@ func RollbackDocHistory(boxID, historyPath string) (err error) {
workingDoc := treenode.GetBlockTree(id)
if nil != workingDoc {
if err = os.RemoveAll(filepath.Join(util.DataDir, boxID, workingDoc.Path)); nil != err {
util.WritingFileLock.Unlock()
util.UnlockWriteFile()
return
}
}
destPath, err = getRollbackDockPath(boxID, historyPath)
if nil != err {
util.WritingFileLock.Unlock()
util.UnlockWriteFile()
return
}
if err = gulu.File.Copy(srcPath, destPath); nil != err {
util.WritingFileLock.Unlock()
util.UnlockWriteFile()
return
}
util.WritingFileLock.Unlock()
util.UnlockWriteFile()
FullReindex()
IncSync()