mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 07:00:12 +01:00
⚡ 云端数据同步时降低交互阻塞时间 Fix https://github.com/siyuan-note/siyuan/issues/4984
This commit is contained in:
parent
1cdc80e1bd
commit
c88bd514d3
10 changed files with 63 additions and 91 deletions
|
|
@ -50,9 +50,6 @@ func generateDocHistory() {
|
|||
}
|
||||
|
||||
WaitForWritingFiles()
|
||||
syncLock.Lock()
|
||||
defer syncLock.Unlock()
|
||||
|
||||
for _, box := range Conf.GetOpenedBoxes() {
|
||||
box.generateDocHistory0()
|
||||
}
|
||||
|
|
@ -158,7 +155,7 @@ func RollbackDocHistory(boxID, historyPath string) (err error) {
|
|||
}
|
||||
|
||||
WaitForWritingFiles()
|
||||
syncLock.Lock()
|
||||
writingDataLock.Lock()
|
||||
|
||||
srcPath := historyPath
|
||||
var destPath string
|
||||
|
|
@ -169,22 +166,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 {
|
||||
syncLock.Unlock()
|
||||
writingDataLock.Unlock()
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
destPath, err = getRollbackDockPath(boxID, historyPath)
|
||||
if nil != err {
|
||||
syncLock.Unlock()
|
||||
writingDataLock.Unlock()
|
||||
return
|
||||
}
|
||||
|
||||
if err = gulu.File.Copy(srcPath, destPath); nil != err {
|
||||
syncLock.Unlock()
|
||||
writingDataLock.Unlock()
|
||||
return
|
||||
}
|
||||
syncLock.Unlock()
|
||||
writingDataLock.Unlock()
|
||||
|
||||
RefreshFileTree()
|
||||
IncWorkspaceDataVer()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue