🎨 Perform indexing in the background when moving a large number of documents Fix https://github.com/siyuan-note/siyuan/issues/9356

This commit is contained in:
Daniel 2023-10-05 21:06:30 +08:00
parent e1d8a609d0
commit 125b180029
No known key found for this signature in database
GPG key ID: 86211BA83DF03017

View file

@ -1124,14 +1124,21 @@ func MoveDocs(fromPaths []string, toBoxID, toPath string, callback interface{})
}
}
// A progress layer appears when moving more than 16 documents at once https://github.com/siyuan-note/siyuan/issues/9356
needShowProgress := 16 < len(fromPaths)
if needShowProgress {
util.PushEndlessProgress(Conf.Language(116))
defer util.PushClearProgress()
}
WaitForWritingFiles()
luteEngine := util.NewLute()
count := 0
for fromPath, fromBox := range pathsBoxes {
count++
if needShowProgress {
util.PushEndlessProgress(fmt.Sprintf(Conf.Language(70), fmt.Sprintf("%d/%d", count, len(fromPaths))))
}
_, err = moveDoc(fromBox, fromPath, toBox, toPath, luteEngine, callback)
if nil != err {
return
@ -1139,12 +1146,6 @@ func MoveDocs(fromPaths []string, toBoxID, toPath string, callback interface{})
}
cache.ClearDocsIAL()
IncSync()
if needShowProgress {
util.PushEndlessProgress(Conf.Language(113))
sql.WaitForWritingDatabase()
util.ReloadUI()
}
return
}