mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-27 18:56:09 +01:00
🎨 细化云端同步锁提升稳定性 https://github.com/siyuan-note/siyuan/issues/5887
This commit is contained in:
parent
963b409e4e
commit
11e4c88f5a
15 changed files with 110 additions and 106 deletions
|
|
@ -29,13 +29,12 @@ import (
|
|||
"github.com/88250/lute/ast"
|
||||
"github.com/siyuan-note/filelock"
|
||||
"github.com/siyuan-note/logging"
|
||||
"github.com/siyuan-note/siyuan/kernel/filesys"
|
||||
"github.com/siyuan-note/siyuan/kernel/treenode"
|
||||
"github.com/siyuan-note/siyuan/kernel/util"
|
||||
)
|
||||
|
||||
func CreateBox(name string) (id string, err error) {
|
||||
WaitForWritingFiles()
|
||||
|
||||
id = ast.NewNodeID()
|
||||
boxLocalPath := filepath.Join(util.DataDir, id)
|
||||
err = os.MkdirAll(boxLocalPath, 0755)
|
||||
|
|
@ -52,10 +51,6 @@ func CreateBox(name string) (id string, err error) {
|
|||
}
|
||||
|
||||
func RenameBox(boxID, name string) (err error) {
|
||||
WaitForWritingFiles()
|
||||
util.LockWriteFile()
|
||||
defer util.UnlockWriteFile()
|
||||
|
||||
box := Conf.Box(boxID)
|
||||
if nil == box {
|
||||
return errors.New(Conf.Language(0))
|
||||
|
|
@ -103,7 +98,7 @@ func RemoveBox(boxID string) (err error) {
|
|||
}
|
||||
|
||||
unmount0(boxID)
|
||||
if err = os.RemoveAll(localPath); nil != err {
|
||||
if err = filesys.RemoveAll(localPath); nil != err {
|
||||
return
|
||||
}
|
||||
IncSync()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue