This commit is contained in:
Liang Ding 2023-04-02 11:42:04 +08:00
parent 2d190bf708
commit e8e645f02b
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
3 changed files with 19 additions and 2 deletions

View file

@ -35,5 +35,11 @@ func renderAttributeView(c *gin.Context) {
} }
id := arg["id"].(string) 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" "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) attrView, err := av.ParseAttributeView(avID)
if nil != err { if nil != err {
logging.LogErrorf("parse attribute view [%s] failed: %s", avID, 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 syncingFiles = sync.Map{}
var syncingStorages = false var syncingStorages = false
func waitForSyncingStorages() {
for i := 0; i < 30; i++ {
if syncingStorages {
return
}
time.Sleep(time.Second)
}
}
func IsSyncingFile(rootID string) (ret bool) { func IsSyncingFile(rootID string) (ret bool) {
_, ret = syncingFiles.Load(rootID) _, ret = syncingFiles.Load(rootID)
return return