云端数据同步时降低交互阻塞时间 Fix https://github.com/siyuan-note/siyuan/issues/4984

This commit is contained in:
Liang Ding 2022-05-30 10:50:12 +08:00
parent 1cdc80e1bd
commit c88bd514d3
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
10 changed files with 63 additions and 91 deletions

View file

@ -145,8 +145,6 @@ func RecoverLocalBackup() (err error) {
data, _ = hex.DecodeString(string(data))
passwd := string(data)
syncLock.Lock()
defer syncLock.Unlock()
CloseWatchAssets()
defer WatchAssets()
@ -233,7 +231,7 @@ func RecoverLocalBackup() (err error) {
util.PushEndlessProgress(Conf.Language(62))
time.Sleep(2 * time.Second)
refreshFileTree()
RefreshFileTree()
if syncEnabled {
func() {
time.Sleep(5 * time.Second)
@ -252,8 +250,6 @@ func CreateLocalBackup() (err error) {
util.PushEndlessProgress(Conf.Language(22))
WaitForWritingFiles()
syncLock.Lock()
defer syncLock.Unlock()
filesys.ReleaseAllFileLocks()
@ -326,9 +322,6 @@ func CreateLocalBackup() (err error) {
}
func DownloadBackup() (err error) {
syncLock.Lock()
defer syncLock.Unlock()
// 使用索引文件进行解密验证 https://github.com/siyuan-note/siyuan/issues/3789
var tmpFetchedFiles int
var tmpTransferSize uint64
@ -367,9 +360,6 @@ func UploadBackup() (err error) {
return
}
syncLock.Lock()
defer syncLock.Unlock()
localDirPath := Conf.Backup.GetSaveDir()
util.PushEndlessProgress(Conf.Language(61))
util.LogInfof("uploading backup...")