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 data sync performance https://github.com/siyuan-note/siyuan/issues/13216
Daniel4443f3e9296b
diff --git a/kernel/go.mod b/kernel/go.modindex 93fca4b241..7c35d37414 100644--- a/kernel/go.mod+++ b/kernel/go.mod@@ -56,7 +56,7 @@ require (github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06github.com/sashabaranov/go-openai v1.29.1github.com/shirou/gopsutil/v3 v3.24.5- github.com/siyuan-note/dejavu v0.0.0-20241123152109-fc98d29be247+ github.com/siyuan-note/dejavu v0.0.0-20241124021155-df73bbaf4338github.com/siyuan-note/encryption v0.0.0-20231219001248-1e028a4d13b4github.com/siyuan-note/eventbus v0.0.0-20240627125516-396fdb0f0f97github.com/siyuan-note/filelock v0.0.0-20241121021809-1cf0626a7d64diff --git a/kernel/go.sum b/kernel/go.sumindex 4d4786b48c..fa86c7441f 100644--- a/kernel/go.sum+++ b/kernel/go.sum@@ -340,8 +340,8 @@ github.com/shopspring/decimal v1.4.0/go.mod h1:gawqmDU56v4yIKSwfBSFip1HdCCXN8/+Dgithub.com/shurcooL/gofontwoff v0.0.0-20181114050219-180f79e6909d h1:lvCTyBbr36+tqMccdGMwuEU+hjux/zL6xSmf5S9ITaA=github.com/shurcooL/gofontwoff v0.0.0-20181114050219-180f79e6909d/go.mod h1:05UtEgK5zq39gLST6uB0cf3NEHjETfB4Fgr3Gx5R9Vw=github.com/simplereach/timeutils v1.2.0/go.mod h1:VVbQDfN/FHRZa1LSqcwo4kNZ62OOyqLLGQKYB3pB0Q8=-github.com/siyuan-note/dejavu v0.0.0-20241123152109-fc98d29be247 h1:AS2ujNHMtejpoU/9W/k5U/iHW+qSgatPPXeiIQl/gPs=-github.com/siyuan-note/dejavu v0.0.0-20241123152109-fc98d29be247/go.mod h1:KBNaIdV5TSJmWrdof7C7A46RhB0IVm8hofDox0zgMqA=+github.com/siyuan-note/dejavu v0.0.0-20241124021155-df73bbaf4338 h1:rnuhUDyBLpKKIEuUhnUJXwE1SLemfNDzNKX/mWWkKl4=+github.com/siyuan-note/dejavu v0.0.0-20241124021155-df73bbaf4338/go.mod h1:KBNaIdV5TSJmWrdof7C7A46RhB0IVm8hofDox0zgMqA=github.com/siyuan-note/encryption v0.0.0-20231219001248-1e028a4d13b4 h1:kJaw5L/evyW6LcB9IQT8PR4ppx8JVqOFP9Ix3rfwSrc=github.com/siyuan-note/encryption v0.0.0-20231219001248-1e028a4d13b4/go.mod h1:UYcCCY+0wh+GmUoDOaO63j1sV5lgy7laLAk1XhEiUis=github.com/siyuan-note/eventbus v0.0.0-20240627125516-396fdb0f0f97 h1:lM5v8BfNtbOL5jYwhCdMYBcYtr06IYBKjjSLAPMKTM8=diff --git a/kernel/model/repository.go b/kernel/model/repository.goindex e00a2ace71..851f14a9c1 100644--- a/kernel/model/repository.go+++ b/kernel/model/repository.go@@ -752,7 +752,7 @@ func checkoutRepo(id string) {// 回滚快照时默认为当前数据创建一个快照// When rolling back a snapshot, a snapshot is created for the current data by default https://github.com/siyuan-note/siyuan/issues/12470FlushTxQueue()- _, err = repo.Index("Backup before checkout", map[string]interface{}{eventbus.CtxPushMsg: eventbus.CtxPushMsgToStatusBarAndProgress})+ _, err = repo.Index("Backup before checkout", false, map[string]interface{}{eventbus.CtxPushMsg: eventbus.CtxPushMsgToStatusBarAndProgress})if err != nil {logging.LogErrorf("index repository failed: %s", err)util.PushClearProgress()@@ -1074,7 +1074,7 @@ func IndexRepo(memo string) (err error) {start := time.Now()latest, _ := repo.Latest()FlushTxQueue()- index, err := repo.Index(memo, map[string]interface{}{+ index, err := repo.Index(memo, true, map[string]interface{}{eventbus.CtxPushMsg: eventbus.CtxPushMsgToStatusBarAndProgress,})if err != nil {@@ -1770,9 +1770,15 @@ func indexRepoBeforeCloudSync(repo *dejavu.Repo) (beforeIndex, afterIndex *entitbeforeIndex, _ = repo.Latest()FlushTxQueue()- afterIndex, err = repo.Index("[Sync] Cloud sync", map[string]interface{}{- eventbus.CtxPushMsg: eventbus.CtxPushMsgToStatusBar,- })++ checkChunks := true+ if util.ContainerAndroid == util.Container || util.ContainerIOS == util.Container || util.ContainerHarmony == util.Container {+ // 因为移动端私有数据空间不会存在外部操作导致分块损坏的情况,所以不需要检查分块以提升性能 https://github.com/siyuan-note/siyuan/issues/13216+ checkChunks = false+ }++ afterIndex, err = repo.Index("[Sync] Cloud sync", checkChunks,+ map[string]interface{}{eventbus.CtxPushMsg: eventbus.CtxPushMsgToStatusBar})if err != nil {logging.LogErrorf("index data repo before cloud sync failed: %s", err)return