mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 23:20:13 +01:00
🎨 细化云端同步锁提升稳定性 https://github.com/siyuan-note/siyuan/issues/5887
This commit is contained in:
parent
7bc8fba466
commit
90f45a420e
15 changed files with 79 additions and 81 deletions
|
|
@ -291,6 +291,9 @@ func (box *Box) Move(oldPath, newPath string) error {
|
|||
fromPath := filepath.Join(boxLocalPath, oldPath)
|
||||
toPath := filepath.Join(boxLocalPath, newPath)
|
||||
filelock.ReleaseFileLocks(fromPath)
|
||||
|
||||
util.WritingFileLock.Lock()
|
||||
defer util.WritingFileLock.Unlock()
|
||||
if err := os.Rename(fromPath, toPath); nil != err {
|
||||
msg := fmt.Sprintf(Conf.Language(5), box.Name, fromPath, err)
|
||||
logging.LogErrorf("move [path=%s] in box [%s] failed: %s", fromPath, box.Name, err)
|
||||
|
|
@ -310,8 +313,7 @@ func (box *Box) Move(oldPath, newPath string) error {
|
|||
func (box *Box) Remove(path string) error {
|
||||
boxLocalPath := filepath.Join(util.DataDir, box.ID)
|
||||
filePath := filepath.Join(boxLocalPath, path)
|
||||
filelock.ReleaseFileLocks(filePath)
|
||||
if err := os.RemoveAll(filePath); nil != err {
|
||||
if err := util.RemoveAll(filePath); nil != err {
|
||||
msg := fmt.Sprintf(Conf.Language(7), box.Name, path, err)
|
||||
logging.LogErrorf("remove [path=%s] in box [%s] failed: %s", path, box.ID, err)
|
||||
return errors.New(msg)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue