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

This commit is contained in:
Vanessa 2023-04-02 12:03:48 +08:00
commit f70ea553f2
3 changed files with 19 additions and 2 deletions

View file

@ -35,5 +35,11 @@ func renderAttributeView(c *gin.Context) {
}
id := arg["id"].(string)
ret.Data = model.RenderAttributeView(id)
data, err := model.RenderAttributeView(id)
if nil != err {
ret.Code = -1
ret.Msg = err.Error()
return
}
ret.Data = data
}

View file

@ -28,7 +28,9 @@ import (
"github.com/siyuan-note/siyuan/kernel/treenode"
)
func RenderAttributeView(avID string) (dom string) {
func RenderAttributeView(avID string) (dom string, err error) {
waitForSyncingStorages()
attrView, err := av.ParseAttributeView(avID)
if nil != err {
logging.LogErrorf("parse attribute view [%s] failed: %s", avID, err)

View file

@ -771,6 +771,15 @@ func IndexRepo(memo string) (err error) {
var syncingFiles = sync.Map{}
var syncingStorages = false
func waitForSyncingStorages() {
for i := 0; i < 30; i++ {
if syncingStorages {
return
}
time.Sleep(time.Second)
}
}
func IsSyncingFile(rootID string) (ret bool) {
_, ret = syncingFiles.Load(rootID)
return