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

This commit is contained in:
Liang Ding 2022-09-18 09:14:34 +08:00
parent 963b409e4e
commit 11e4c88f5a
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
15 changed files with 110 additions and 106 deletions

View file

@ -39,6 +39,7 @@ import (
"github.com/siyuan-note/httpclient"
"github.com/siyuan-note/logging"
"github.com/siyuan-note/siyuan/kernel/cache"
"github.com/siyuan-note/siyuan/kernel/filesys"
"github.com/siyuan-note/siyuan/kernel/search"
"github.com/siyuan-note/siyuan/kernel/sql"
"github.com/siyuan-note/siyuan/kernel/treenode"
@ -141,7 +142,7 @@ func NetImg2LocalAssets(rootID string) (err error) {
name = util.FilterFileName(name)
name = "net-img-" + name + "-" + ast.NewNodeID() + ext
writePath := filepath.Join(util.DataDir, "assets", name)
if err = util.WriteFileSafer(writePath, data); nil != err {
if err = filesys.WriteFileSafer(writePath, data); nil != err {
logging.LogErrorf("write downloaded net img [%s] to local assets [%s] failed: %s", u, writePath, err)
return ast.WalkSkipChildren
}
@ -383,7 +384,7 @@ func saveWorkspaceAssets(assets []string) {
logging.LogErrorf("create assets conf failed: %s", err)
return
}
if err = util.WriteFileSafer(confPath, data); nil != err {
if err = filesys.WriteFileSafer(confPath, data); nil != err {
logging.LogErrorf("write assets conf failed: %s", err)
return
}
@ -478,7 +479,7 @@ func RenameAsset(oldPath, newName string) (err error) {
newName = util.AssetName(newName) + filepath.Ext(oldPath)
newPath := "assets/" + newName
if err = util.Copy(filepath.Join(util.DataDir, oldPath), filepath.Join(util.DataDir, newPath)); nil != err {
if err = filesys.Copy(filepath.Join(util.DataDir, oldPath), filepath.Join(util.DataDir, newPath)); nil != err {
logging.LogErrorf("copy asset [%s] failed: %s", oldPath, err)
return
}