Improve database table view update time column rendering performance https://github.com/siyuan-note/siyuan/issues/9719

This commit is contained in:
Daniel 2023-11-22 16:48:20 +08:00
parent 72752f441a
commit 5c182e2ea7
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
2 changed files with 30 additions and 5 deletions

View file

@ -268,3 +268,28 @@ func GetBlockAttrs(id string) (ret map[string]string) {
cache.PutBlockIAL(id, ret)
return
}
func GetBlockAttrsWithoutWaitWriting(id string) (ret map[string]string) {
ret = map[string]string{}
if cached := cache.GetBlockIAL(id); nil != cached {
ret = cached
return
}
tree, err := loadTreeByBlockID(id)
if nil != err {
return
}
node := treenode.GetNodeInTree(tree, id)
if nil == node {
logging.LogWarnf("block [%s] not found", id)
return
}
for _, kv := range node.KramdownIAL {
ret[kv[0]] = html.UnescapeAttrVal(kv[1])
}
cache.PutBlockIAL(id, ret)
return
}