Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
Vanessa 2022-09-17 22:04:22 +08:00
commit 7bc8fba466
3 changed files with 7 additions and 4 deletions

View file

@ -141,6 +141,8 @@ func NetImg2LocalAssets(rootID string) (err error) {
name = util.FilterFileName(name)
name = "net-img-" + name + "-" + ast.NewNodeID() + ext
writePath := filepath.Join(util.DataDir, "assets", name)
writingDataLock.Lock()
defer writingDataLock.Unlock()
if err = gulu.File.WriteFileSafer(writePath, data, 0644); nil != err {
logging.LogErrorf("write downloaded net img [%s] to local assets [%s] failed: %s", u, writePath, err)
return ast.WalkSkipChildren

View file

@ -26,7 +26,6 @@ import (
"github.com/88250/lute/render"
"github.com/siyuan-note/filelock"
"github.com/siyuan-note/logging"
"github.com/siyuan-note/siyuan/kernel/sql"
"github.com/siyuan-note/siyuan/kernel/util"
)
@ -39,6 +38,8 @@ func AutoSpace(rootID string) (err error) {
util.PushEndlessProgress(Conf.Language(116))
defer util.ClearPushProgress(100)
WaitForWritingFiles()
generateFormatHistory(tree)
luteEngine := NewLute()
// 合并相邻的同类行级节点
@ -76,7 +77,7 @@ func AutoSpace(rootID string) (err error) {
if nil != err {
return
}
sql.WaitForWritingDatabase()
util.RandomSleep(500, 700)
return
}

View file

@ -351,8 +351,6 @@ func ImportFromLocalPath(boxID, localPath string, toPath string) (err error) {
util.PushEndlessProgress(Conf.Language(73))
WaitForWritingFiles()
writingDataLock.Lock()
defer writingDataLock.Unlock()
var baseHPath, baseTargetPath, boxLocalPath string
if "/" == toPath {
@ -503,6 +501,8 @@ func ImportFromLocalPath(boxID, localPath string, toPath string) (err error) {
})
reassignIDUpdated(tree)
writingDataLock.Lock()
defer writingDataLock.Unlock()
if err = filesys.WriteTree(tree); nil != err {
return io.EOF
}