Skip to content

Commit

Permalink
🎨 Prevent syncMergeResult push nil
Browse files Browse the repository at this point in the history
  • Loading branch information
88250 committed Jan 16, 2024
1 parent ff8ee37 commit 52b400c
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions kernel/model/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,13 @@ func incReindex(upserts, removes []string) (upsertRootIDs, removeRootIDs []strin
util.IncBootProgress(3, "Sync reindexing...")
removeRootIDs = removeIndexes(removes) // 先执行 remove,否则移动文档时 upsert 会被忽略,导致未被索引
upsertRootIDs = upsertIndexes(upserts)

if 1 > len(removeRootIDs) {
removeRootIDs = []string{}
}
if 1 > len(upsertRootIDs) {
upsertRootIDs = []string{}
}
return
}

Expand All @@ -301,6 +308,10 @@ func removeIndexes(removeFilePaths []string) (removeRootIDs []string) {
sql.RemoveTreeQueue(block.BoxID, block.RootID)
}
}

if 1 > len(removeRootIDs) {
removeRootIDs = []string{}
}
return
}

Expand Down Expand Up @@ -336,6 +347,10 @@ func upsertIndexes(upsertFilePaths []string) (upsertRootIDs []string) {
sql.UpsertTreeQueue(tree)
upsertRootIDs = append(upsertRootIDs, tree.Root.ID)
}

if 1 > len(upsertRootIDs) {
upsertRootIDs = []string{}
}
return
}

Expand Down

0 comments on commit 52b400c

Please sign in to comment.