mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-23 18:10:12 +01:00
🎨 细化云端同步锁提升稳定性 https://github.com/siyuan-note/siyuan/issues/5887
This commit is contained in:
parent
7bc8fba466
commit
90f45a420e
15 changed files with 79 additions and 81 deletions
|
|
@ -238,7 +238,7 @@ func RollbackDocHistory(boxID, historyPath string) (err error) {
|
|||
}
|
||||
|
||||
WaitForWritingFiles()
|
||||
writingDataLock.Lock()
|
||||
util.WritingFileLock.Lock()
|
||||
|
||||
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 {
|
||||
writingDataLock.Unlock()
|
||||
util.WritingFileLock.Unlock()
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
destPath, err = getRollbackDockPath(boxID, historyPath)
|
||||
if nil != err {
|
||||
writingDataLock.Unlock()
|
||||
util.WritingFileLock.Unlock()
|
||||
return
|
||||
}
|
||||
|
||||
if err = gulu.File.Copy(srcPath, destPath); nil != err {
|
||||
writingDataLock.Unlock()
|
||||
util.WritingFileLock.Unlock()
|
||||
return
|
||||
}
|
||||
writingDataLock.Unlock()
|
||||
util.WritingFileLock.Unlock()
|
||||
|
||||
FullReindex()
|
||||
IncSync()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue