From 27618dd849c465a622dc4c7c688a4c58210790d9 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Wed, 16 Oct 2024 11:44:45 +0800 Subject: [PATCH 01/17] :bug: The word count of the selected block is inaccurate https://github.com/siyuan-note/siyuan/issues/12793 --- kernel/filesys/tree.go | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/kernel/filesys/tree.go b/kernel/filesys/tree.go index 654521b76..3d7d9b63a 100644 --- a/kernel/filesys/tree.go +++ b/kernel/filesys/tree.go @@ -43,19 +43,17 @@ func LoadTrees(ids []string) (ret map[string]*parse.Tree) { luteEngine := util.NewLute() var boxIDs []string var paths []string - blockIDs := map[string]string{} - seen := map[string]bool{} + blockIDs := map[string][]string{} for _, bt := range bts { - key := bt.BoxID + bt.Path - if !seen[key] { - seen[key] = true - boxIDs = append(boxIDs, bt.BoxID) - paths = append(paths, bt.Path) - blockIDs[bt.RootID] = bt.ID + boxIDs = append(boxIDs, bt.BoxID) + paths = append(paths, bt.Path) + if _, ok := blockIDs[bt.RootID]; !ok { + blockIDs[bt.RootID] = []string{} } + blockIDs[bt.RootID] = append(blockIDs[bt.RootID], bt.ID) } - trees, errs := batchLoadTrees(boxIDs, paths, luteEngine) + trees, errs := BatchLoadTrees(boxIDs, paths, luteEngine) for i := range trees { tree := trees[i] err := errs[i] @@ -64,8 +62,10 @@ func LoadTrees(ids []string) (ret map[string]*parse.Tree) { continue } - id := blockIDs[tree.Root.ID] - ret[id] = tree + bIDs := blockIDs[tree.Root.ID] + for _, bID := range bIDs { + ret[bID] = tree + } } return } @@ -82,11 +82,18 @@ func LoadTree(boxID, p string, luteEngine *lute.Lute) (ret *parse.Tree, err erro return } -func batchLoadTrees(boxIDs, paths []string, luteEngine *lute.Lute) (ret []*parse.Tree, errs []error) { +func BatchLoadTrees(boxIDs, paths []string, luteEngine *lute.Lute) (ret []*parse.Tree, errs []error) { var wg sync.WaitGroup lock := sync.Mutex{} + loaded := map[string]bool{} for i := range paths { + if loaded[boxIDs[i]+paths[i]] { + continue + } + + loaded[boxIDs[i]+paths[i]] = true wg.Add(1) + go func(i int) { defer wg.Done() From 488e87b70bc152ddaacdfb9f1daa1ebfeda2daed Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Wed, 16 Oct 2024 19:29:11 +0800 Subject: [PATCH 02/17] :art: WebDAV/S3 data sync and backup support configurable concurrent requests https://github.com/siyuan-note/siyuan/issues/12798 --- app/src/config/repos.ts | 26 ++++++++++++++++++++++++++ app/src/types/config.d.ts | 8 ++++++++ kernel/conf/sync.go | 28 +++++++++++++++------------- kernel/go.mod | 2 +- kernel/go.sum | 4 ++-- kernel/model/conf.go | 6 ++++-- kernel/model/repository.go | 2 ++ kernel/model/sync.go | 2 ++ kernel/util/path.go | 15 +++++++++++++++ 9 files changed, 75 insertions(+), 18 deletions(-) diff --git a/app/src/config/repos.ts b/app/src/config/repos.ts index 0a9066b84..6aa6496c1 100644 --- a/app/src/config/repos.ts +++ b/app/src/config/repos.ts @@ -99,6 +99,11 @@ const renderProvider = (provider: number) => { +
+
Concurrent Reqs
+
+ +
+
+
Concurrent Reqs
+
+ +