mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-22 09:30:14 +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)
|
needShowProgress := 16 < len(fromPaths)
|
||||||
if needShowProgress {
|
if needShowProgress {
|
||||||
util.PushEndlessProgress(Conf.Language(116))
|
defer util.PushClearProgress()
|
||||||
}
|
}
|
||||||
|
|
||||||
WaitForWritingFiles()
|
WaitForWritingFiles()
|
||||||
luteEngine := util.NewLute()
|
luteEngine := util.NewLute()
|
||||||
|
count := 0
|
||||||
for fromPath, fromBox := range pathsBoxes {
|
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)
|
_, err = moveDoc(fromBox, fromPath, toBox, toPath, luteEngine, callback)
|
||||||
if nil != err {
|
if nil != err {
|
||||||
return
|
return
|
||||||
|
|
@ -1139,12 +1146,6 @@ func MoveDocs(fromPaths []string, toBoxID, toPath string, callback interface{})
|
||||||
}
|
}
|
||||||
cache.ClearDocsIAL()
|
cache.ClearDocsIAL()
|
||||||
IncSync()
|
IncSync()
|
||||||
|
|
||||||
if needShowProgress {
|
|
||||||
util.PushEndlessProgress(Conf.Language(113))
|
|
||||||
sql.WaitForWritingDatabase()
|
|
||||||
util.ReloadUI()
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue