Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
f9f60c9c8e
2 changed files with 23 additions and 19 deletions
|
@ -178,7 +178,7 @@ func AutoRefreshUser() {
|
||||||
defer util.Recover()
|
defer util.Recover()
|
||||||
|
|
||||||
if nil != Conf.User {
|
if nil != Conf.User {
|
||||||
time.Sleep(3 * time.Minute)
|
time.Sleep(2 * time.Minute)
|
||||||
if nil != Conf.User {
|
if nil != Conf.User {
|
||||||
RefreshUser(Conf.User.UserToken)
|
RefreshUser(Conf.User.UserToken)
|
||||||
}
|
}
|
||||||
|
@ -200,6 +200,7 @@ func AutoRefreshUser() {
|
||||||
}
|
}
|
||||||
if err = gulu.JSON.UnmarshalJSON(data, &existingAnnouncements); nil != err {
|
if err = gulu.JSON.UnmarshalJSON(data, &existingAnnouncements); nil != err {
|
||||||
util.LogErrorf("unmarshal announcement conf failed: %s", err)
|
util.LogErrorf("unmarshal announcement conf failed: %s", err)
|
||||||
|
os.Remove(announcementConf)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,8 +122,28 @@ func SyncData(boot, exit, byHand bool) {
|
||||||
|
|
||||||
// incReindex 增量重建索引。
|
// incReindex 增量重建索引。
|
||||||
func incReindex(upserts, removes []string) {
|
func incReindex(upserts, removes []string) {
|
||||||
needPushUpsertProgress := 32 < len(upserts)
|
|
||||||
needPushRemoveProgress := 32 < len(removes)
|
needPushRemoveProgress := 32 < len(removes)
|
||||||
|
needPushUpsertProgress := 32 < len(upserts)
|
||||||
|
|
||||||
|
// 先执行 remove,否则移动文档时 upsert 会被忽略,导致未被索引
|
||||||
|
|
||||||
|
for _, removeFile := range removes {
|
||||||
|
if !strings.HasSuffix(removeFile, ".sy") {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
id := strings.TrimSuffix(filepath.Base(removeFile), ".sy")
|
||||||
|
block := treenode.GetBlockTree(id)
|
||||||
|
if nil != block {
|
||||||
|
treenode.RemoveBlockTreesByRootID(block.RootID)
|
||||||
|
sql.RemoveTreeQueue(block.BoxID, block.RootID)
|
||||||
|
msg := fmt.Sprintf("Sync remove tree [%s]", block.RootID)
|
||||||
|
util.PushStatusBar(msg)
|
||||||
|
if needPushRemoveProgress {
|
||||||
|
util.PushEndlessProgress(msg)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for _, upsertFile := range upserts {
|
for _, upsertFile := range upserts {
|
||||||
if !strings.HasSuffix(upsertFile, ".sy") {
|
if !strings.HasSuffix(upsertFile, ".sy") {
|
||||||
|
@ -154,23 +174,6 @@ func incReindex(upserts, removes []string) {
|
||||||
util.PushEndlessProgress(msg)
|
util.PushEndlessProgress(msg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for _, removeFile := range removes {
|
|
||||||
if !strings.HasSuffix(removeFile, ".sy") {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
id := strings.TrimSuffix(filepath.Base(removeFile), ".sy")
|
|
||||||
block := treenode.GetBlockTree(id)
|
|
||||||
if nil != block {
|
|
||||||
treenode.RemoveBlockTreesByRootID(block.RootID)
|
|
||||||
sql.RemoveTreeQueue(block.BoxID, block.RootID)
|
|
||||||
msg := fmt.Sprintf("Sync remove tree [%s]", block.RootID)
|
|
||||||
util.PushStatusBar(msg)
|
|
||||||
if needPushRemoveProgress {
|
|
||||||
util.PushEndlessProgress(msg)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if needPushRemoveProgress || needPushUpsertProgress {
|
if needPushRemoveProgress || needPushUpsertProgress {
|
||||||
util.PushClearProgress()
|
util.PushClearProgress()
|
||||||
|
|
Loading…
Add table
Reference in a new issue