Skip to content

Commit

Permalink
🎨 公测云端同步数据仓库 #5337
Browse files Browse the repository at this point in the history
  • Loading branch information
88250 committed Jul 4, 2022
1 parent dc2e997 commit 67ffbc9
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions kernel/model/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,9 @@ func clearEmptyDirs(dir string) {

// incReindex 增量重建索引。
func incReindex(upserts, removes []string) {
needPushUpsertProgress := 32 < len(upserts)
needPushRemoveProgress := 32 < len(removes)

for _, upsertFile := range upserts {
if !strings.HasSuffix(upsertFile, ".sy") {
continue
Expand All @@ -453,7 +456,11 @@ func incReindex(upserts, removes []string) {
}
treenode.ReindexBlockTree(tree)
sql.UpsertTreeQueue(tree)
//util.LogInfof("sync index tree [%s]", tree.ID)
msg := fmt.Sprintf("Sync reindex tree [%s]", tree.ID)
util.PushStatusBar(msg)
if needPushUpsertProgress {
util.PushEndlessProgress(msg)
}
}
for _, removeFile := range removes {
if !strings.HasSuffix(removeFile, ".sy") {
Expand All @@ -465,9 +472,17 @@ func incReindex(upserts, removes []string) {
if nil != block {
treenode.RemoveBlockTreesByRootID(block.RootID)
sql.RemoveTreeQueue(block.BoxID, block.RootID)
//util.LogInfof("sync remove tree [%s]", block.RootID)
msg := fmt.Sprintf("Sync remove tree [%s]", block.RootID)
util.PushStatusBar(msg)
if needPushRemoveProgress {
util.PushEndlessProgress(msg)
}
}
}

if needPushRemoveProgress || needPushUpsertProgress {
util.PushClearProgress()
}
}

func SetCloudSyncDir(name string) {
Expand Down

0 comments on commit 67ffbc9

Please sign in to comment.