mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-21 17:10:12 +01:00
🎨 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:
parent
e1d8a609d0
commit
125b180029
1 changed files with 8 additions and 7 deletions
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue