mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-26 08:54:07 +01:00
🎨 改进同步
This commit is contained in:
parent
a24e880a02
commit
758c5217bb
6 changed files with 26 additions and 13 deletions
|
|
@ -125,6 +125,11 @@ func SyncData(boot, exit, byHand bool) {
|
|||
func incReindex(upserts, removes []string) {
|
||||
needPushRemoveProgress := 32 < len(removes)
|
||||
needPushUpsertProgress := 32 < len(upserts)
|
||||
msg := fmt.Sprintf(Conf.Language(35))
|
||||
util.PushStatusBar(msg)
|
||||
if needPushRemoveProgress || needPushUpsertProgress {
|
||||
util.PushEndlessProgress(msg)
|
||||
}
|
||||
|
||||
// 先执行 remove,否则移动文档时 upsert 会被忽略,导致未被索引
|
||||
|
||||
|
|
@ -138,7 +143,7 @@ func incReindex(upserts, removes []string) {
|
|||
if nil != block {
|
||||
treenode.RemoveBlockTreesByRootID(block.RootID)
|
||||
sql.RemoveTreeQueue(block.BoxID, block.RootID)
|
||||
msg := fmt.Sprintf("Sync remove tree [%s]", block.RootID)
|
||||
msg = fmt.Sprintf(Conf.Language(39), block.RootID)
|
||||
util.PushStatusBar(msg)
|
||||
if needPushRemoveProgress {
|
||||
util.PushEndlessProgress(msg)
|
||||
|
|
@ -146,6 +151,13 @@ func incReindex(upserts, removes []string) {
|
|||
}
|
||||
}
|
||||
|
||||
msg = fmt.Sprintf(Conf.Language(35))
|
||||
util.PushStatusBar(msg)
|
||||
if needPushRemoveProgress || needPushUpsertProgress {
|
||||
util.PushEndlessProgress(msg)
|
||||
}
|
||||
sql.WaitForWritingDatabase()
|
||||
|
||||
for _, upsertFile := range upserts {
|
||||
if !strings.HasSuffix(upsertFile, ".sy") {
|
||||
continue
|
||||
|
|
@ -169,15 +181,16 @@ func incReindex(upserts, removes []string) {
|
|||
}
|
||||
treenode.ReindexBlockTree(tree)
|
||||
sql.UpsertTreeQueue(tree)
|
||||
msg := fmt.Sprintf("Sync reindex tree [%s]", tree.ID)
|
||||
msg = fmt.Sprintf(Conf.Language(40), tree.ID)
|
||||
util.PushStatusBar(msg)
|
||||
if needPushUpsertProgress {
|
||||
util.PushEndlessProgress(msg)
|
||||
}
|
||||
}
|
||||
|
||||
util.PushStatusBar(Conf.Language(58))
|
||||
if needPushRemoveProgress || needPushUpsertProgress {
|
||||
util.PushClearProgress()
|
||||
util.PushEndlessProgress(Conf.Language(58))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue