This commit is contained in:
Liang Ding 2022-07-19 01:05:39 +08:00
parent 5b9f2c3cb1
commit d7e7e16422
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
2 changed files with 12 additions and 7 deletions

View file

@ -135,6 +135,7 @@ func incReindex(upserts, removes []string) {
logging.LogDebugf("sync reindex [upserts=%d, removes=%d]", len(upserts), len(removes))
// 先执行 remove否则移动文档时 upsert 会被忽略,导致未被索引
bootProgressPart := 10 / float64(len(removes))
for _, removeFile := range removes {
if !strings.HasSuffix(removeFile, ".sy") {
continue
@ -143,7 +144,7 @@ func incReindex(upserts, removes []string) {
id := strings.TrimSuffix(filepath.Base(removeFile), ".sy")
block := treenode.GetBlockTree(id)
if nil != block {
util.SetBootDetails("Sync remove tree " + block.Path)
util.IncBootProgress(bootProgressPart, "Sync remove tree "+block.Path)
treenode.RemoveBlockTreesByRootID(block.RootID)
sql.RemoveTreeQueue(block.BoxID, block.RootID)
msg = fmt.Sprintf(Conf.Language(39), block.RootID)
@ -160,6 +161,7 @@ func incReindex(upserts, removes []string) {
util.PushEndlessProgress(msg)
}
bootProgressPart = 10 / float64(len(upserts))
for _, upsertFile := range upserts {
if !strings.HasSuffix(upsertFile, ".sy") {
continue
@ -177,7 +179,7 @@ func incReindex(upserts, removes []string) {
box := upsertFile[:idx]
p := strings.TrimPrefix(upsertFile, box)
util.SetBootDetails("Sync upsert tree " + p)
util.IncBootProgress(bootProgressPart, "Sync upsert tree "+p)
tree, err0 := LoadTree(box, p)
if nil != err0 {
continue