This commit is contained in:
Liang Ding 2022-07-04 22:23:30 +08:00
parent dc2e997b53
commit 67ffbc995a
No known key found for this signature in database
GPG key ID: 136F30F901A2231D

View file

@ -436,6 +436,9 @@ func clearEmptyDirs(dir string) {
// incReindex 增量重建索引。 // incReindex 增量重建索引。
func incReindex(upserts, removes []string) { func incReindex(upserts, removes []string) {
needPushUpsertProgress := 32 < len(upserts)
needPushRemoveProgress := 32 < len(removes)
for _, upsertFile := range upserts { for _, upsertFile := range upserts {
if !strings.HasSuffix(upsertFile, ".sy") { if !strings.HasSuffix(upsertFile, ".sy") {
continue continue
@ -453,7 +456,11 @@ func incReindex(upserts, removes []string) {
} }
treenode.ReindexBlockTree(tree) treenode.ReindexBlockTree(tree)
sql.UpsertTreeQueue(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 { for _, removeFile := range removes {
if !strings.HasSuffix(removeFile, ".sy") { if !strings.HasSuffix(removeFile, ".sy") {
@ -465,9 +472,17 @@ func incReindex(upserts, removes []string) {
if nil != block { if nil != block {
treenode.RemoveBlockTreesByRootID(block.RootID) treenode.RemoveBlockTreesByRootID(block.RootID)
sql.RemoveTreeQueue(block.BoxID, 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) { func SetCloudSyncDir(name string) {