An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:zap: Improve database table view update time column rendering performance https://github.com/siyuan-note/siyuan/issues/9719
Daniel5c182e2ea732
diff --git a/kernel/model/attribute_view.go b/kernel/model/attribute_view.goindex 5428024f4b..bacd17bdc3 100644--- a/kernel/model/attribute_view.go+++ b/kernel/model/attribute_view.go@@ -45,7 +45,7 @@ func GetBlockAttributeViewKeys(blockID string) (ret []*BlockAttributeViewKeys) {waitForSyncingStorages()ret = []*BlockAttributeViewKeys{}- attrs := GetBlockAttrs(blockID)+ attrs := GetBlockAttrsWithoutWaitWriting(blockID)avs := attrs[av.NodeAttrNameAvs]if "" == avs {return@@ -102,7 +102,7 @@ func GetBlockAttributeViewKeys(blockID string) (ret []*BlockAttributeViewKeys) {kv.Values[0].Created = av.NewFormattedValueCreated(time.Now().UnixMilli(), 0, av.CreatedFormatNone)}case av.KeyTypeUpdated:- ial := GetBlockAttrs(blockID)+ ial := GetBlockAttrsWithoutWaitWriting(blockID)updatedStr := ial["updated"]updated, parseErr := time.ParseInLocation("20060102150405", updatedStr, time.Local)if nil == parseErr {@@ -122,7 +122,7 @@ func GetBlockAttributeViewKeys(blockID string) (ret []*BlockAttributeViewKeys) {ial := map[string]string{}block := getRowBlockValue(keyValues)if !block.IsDetached {- ial = GetBlockAttrs(blockID)+ ial = GetBlockAttrsWithoutWaitWriting(blockID)}kv.Values[0].Template.Content = renderTemplateCol(ial, kv.Key.Template, keyValues)}@@ -464,7 +464,7 @@ func renderAttributeViewTable(attrView *av.AttributeView, view *av.View) (ret *aial := map[string]string{}block := row.GetBlockValue()if !block.IsDetached {- ial = GetBlockAttrs(row.ID)+ ial = GetBlockAttrsWithoutWaitWriting(row.ID)}content := renderTemplateCol(ial, cell.Value.Template.Content, keyValues)cell.Value.Template.Content = content@@ -481,7 +481,7 @@ func renderAttributeViewTable(attrView *av.AttributeView, view *av.View) (ret *aial := map[string]string{}block := row.GetBlockValue()if !block.IsDetached {- ial = GetBlockAttrs(row.ID)+ ial = GetBlockAttrsWithoutWaitWriting(row.ID)}updatedStr := ial["updated"]if "" == updatedStr {diff --git a/kernel/model/blockial.go b/kernel/model/blockial.goindex e8bfa2b478..527cf36d1e 100644--- a/kernel/model/blockial.go+++ b/kernel/model/blockial.go@@ -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+}