This commit is contained in:
parent
5b9f2c3cb1
commit
d7e7e16422
2 changed files with 12 additions and 7 deletions
|
@ -662,44 +662,47 @@ func subscribeEvents() {
|
|||
|
||||
eventbus.Subscribe(dejavu.EvtCloudBeforeDownloadIndex, func(context map[string]interface{}, id string) {
|
||||
msg := fmt.Sprintf(Conf.Language(164), id[:7])
|
||||
util.SetBootDetails(msg)
|
||||
util.IncBootProgress(1, msg)
|
||||
contextPushMsg(context, msg)
|
||||
})
|
||||
|
||||
var bootProgressPart float64
|
||||
eventbus.Subscribe(dejavu.EvtCloudBeforeDownloadFiles, func(context map[string]interface{}, ids []string) {
|
||||
msg := fmt.Sprintf(Conf.Language(165), len(ids))
|
||||
util.SetBootDetails(msg)
|
||||
bootProgressPart = 20 / float64(len(ids))
|
||||
contextPushMsg(context, msg)
|
||||
})
|
||||
eventbus.Subscribe(dejavu.EvtCloudBeforeDownloadFile, func(context map[string]interface{}, id string) {
|
||||
msg := fmt.Sprintf(Conf.Language(165), id[:7])
|
||||
util.IncBootProgress(bootProgressPart, msg)
|
||||
count++
|
||||
if 0 == count%32 {
|
||||
util.SetBootDetails(msg)
|
||||
contextPushMsg(context, msg)
|
||||
}
|
||||
})
|
||||
eventbus.Subscribe(dejavu.EvtCloudBeforeDownloadChunks, func(context map[string]interface{}, ids []string) {
|
||||
msg := fmt.Sprintf(Conf.Language(166), len(ids))
|
||||
util.SetBootDetails(msg)
|
||||
bootProgressPart = 20 / float64(len(ids))
|
||||
contextPushMsg(context, msg)
|
||||
})
|
||||
eventbus.Subscribe(dejavu.EvtCloudBeforeDownloadChunk, func(context map[string]interface{}, id string) {
|
||||
msg := fmt.Sprintf(Conf.Language(166), id[:7])
|
||||
util.IncBootProgress(bootProgressPart, msg)
|
||||
count++
|
||||
if 0 == count%32 {
|
||||
util.SetBootDetails(msg)
|
||||
contextPushMsg(context, msg)
|
||||
}
|
||||
})
|
||||
eventbus.Subscribe(dejavu.EvtCloudBeforeDownloadRef, func(context map[string]interface{}, ref string) {
|
||||
msg := fmt.Sprintf(Conf.Language(167), ref)
|
||||
util.SetBootDetails(msg)
|
||||
util.IncBootProgress(1, msg)
|
||||
contextPushMsg(context, msg)
|
||||
})
|
||||
eventbus.Subscribe(dejavu.EvtCloudBeforeUploadIndex, func(context map[string]interface{}, id string) {
|
||||
msg := fmt.Sprintf(Conf.Language(168), id[:7])
|
||||
util.SetBootDetails(msg)
|
||||
util.IncBootProgress(1, msg)
|
||||
contextPushMsg(context, msg)
|
||||
})
|
||||
eventbus.Subscribe(dejavu.EvtCloudBeforeUploadFiles, func(context map[string]interface{}, files []*entity.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
|
||||
|
|
Loading…
Add table
Reference in a new issue