♻️ Improve database loading performance https://github.com/siyuan-note/siyuan/issues/12818

This commit is contained in:
Daniel 2024-10-17 23:31:54 +08:00
parent da64370496
commit c42064ec0b
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
9 changed files with 77 additions and 79 deletions

View file

@ -493,7 +493,7 @@ func GetBlockAttributeViewKeys(blockID string) (ret []*BlockAttributeViewKeys) {
waitForSyncingStorages()
ret = []*BlockAttributeViewKeys{}
attrs := GetBlockAttrsWithoutWaitWriting(blockID)
attrs := sql.GetBlockAttrsWithoutWaitWriting(blockID)
avs := attrs[av.NodeAttrNameAvs]
if "" == avs {
return
@ -631,7 +631,7 @@ func GetBlockAttributeViewKeys(blockID string) (ret []*BlockAttributeViewKeys) {
kv.Values[0].Created = av.NewFormattedValueCreated(time.Now().UnixMilli(), 0, av.CreatedFormatNone)
}
case av.KeyTypeUpdated:
ial := GetBlockAttrsWithoutWaitWriting(blockID)
ial := sql.GetBlockAttrsWithoutWaitWriting(blockID)
updatedStr := ial["updated"]
updated, parseErr := time.ParseInLocation("20060102150405", updatedStr, time.Local)
if nil == parseErr {
@ -655,7 +655,7 @@ func GetBlockAttributeViewKeys(blockID string) (ret []*BlockAttributeViewKeys) {
ial := map[string]string{}
block := av.GetKeyBlockValue(keyValues)
if nil != block && !block.IsDetached {
ial = GetBlockAttrsWithoutWaitWriting(block.BlockID)
ial = sql.GetBlockAttrsWithoutWaitWriting(block.BlockID)
}
if nil == kv.Values[0].Template {
@ -965,7 +965,7 @@ func renderAttributeView(attrView *av.AttributeView, viewID, query string, page,
}
view.Table.Sorts = tmpSorts
viewable = sql.RenderAttributeViewTable(attrView, view, query, GetBlockAttrsWithoutWaitWriting)
viewable = sql.RenderAttributeViewTable(attrView, view, query)
}
viewable.FilterRows(attrView)
@ -2008,7 +2008,7 @@ func addAttributeViewBlock(now int64, avID, blockID, previousBlockID, addingBloc
// 如果存在过滤条件,则将过滤条件应用到新添加的块上
view, _ := getAttrViewViewByBlockID(attrView, blockID)
if nil != view && 0 < len(view.Table.Filters) && !ignoreFillFilter {
viewable := sql.RenderAttributeViewTable(attrView, view, "", GetBlockAttrsWithoutWaitWriting)
viewable := sql.RenderAttributeViewTable(attrView, view, "")
viewable.FilterRows(attrView)
viewable.SortRows(attrView)