mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-04 06:31:47 +01:00
🎨 细化云端同步锁提升稳定性 https://github.com/siyuan-note/siyuan/issues/5887
This commit is contained in:
parent
90f45a420e
commit
3468fb0976
5 changed files with 17 additions and 11 deletions
|
|
@ -383,7 +383,7 @@ func saveWorkspaceAssets(assets []string) {
|
|||
logging.LogErrorf("create assets conf failed: %s", err)
|
||||
return
|
||||
}
|
||||
if err = gulu.File.WriteFileSafer(confPath, data, 0644); nil != err {
|
||||
if err = util.WriteFileSafer(confPath, data); nil != err {
|
||||
logging.LogErrorf("write assets conf failed: %s", err)
|
||||
return
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,9 +34,6 @@ import (
|
|||
)
|
||||
|
||||
func InsertLocalAssets(id string, assetPaths []string) (succMap map[string]interface{}, err error) {
|
||||
util.WritingFileLock.Lock()
|
||||
defer util.WritingFileLock.Unlock()
|
||||
|
||||
succMap = map[string]interface{}{}
|
||||
|
||||
bt := treenode.GetBlockTree(id)
|
||||
|
|
@ -88,7 +85,7 @@ func InsertLocalAssets(id string, assetPaths []string) (succMap map[string]inter
|
|||
f.Close()
|
||||
return
|
||||
}
|
||||
if err = gulu.File.WriteFileSaferByReader(writePath, f, 0644); nil != err {
|
||||
if err = util.WriteFileSaferByReader(writePath, f); nil != err {
|
||||
f.Close()
|
||||
return
|
||||
}
|
||||
|
|
@ -104,9 +101,6 @@ func Upload(c *gin.Context) {
|
|||
ret := gulu.Ret.NewResult()
|
||||
defer c.JSON(200, ret)
|
||||
|
||||
util.WritingFileLock.Lock()
|
||||
defer util.WritingFileLock.Unlock()
|
||||
|
||||
form, err := c.MultipartForm()
|
||||
if nil != err {
|
||||
logging.LogErrorf("insert asset failed: %s", err)
|
||||
|
|
@ -174,7 +168,7 @@ func Upload(c *gin.Context) {
|
|||
f.Close()
|
||||
break
|
||||
}
|
||||
if err = gulu.File.WriteFileSaferByReader(writePath, f, 0644); nil != err {
|
||||
if err = util.WriteFileSaferByReader(writePath, f); nil != err {
|
||||
errFiles = append(errFiles, fName)
|
||||
ret.Msg = err.Error()
|
||||
f.Close()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue