🎨 降低重建索引内存占用 Fix https://github.com/siyuan-note/siyuan/issues/7268
This commit is contained in:
parent
94f623f82a
commit
b9f44309cb
11 changed files with 15 additions and 14 deletions
|
@ -876,6 +876,7 @@
|
|||
"task.database.index.commit": "Execute database index commit",
|
||||
"task.database.index.ref": "Execute database index reference",
|
||||
"task.database.index.fix": "Execute database index fix",
|
||||
"task.database.cache": "Execute database cache",
|
||||
"task.ocr.image": "Execute image OCR to extract text",
|
||||
"task.history.generateDoc": "Execute GenerateDoc History",
|
||||
"task.database.index.embedBlock": "Execute database index embed block",
|
||||
|
|
|
@ -876,6 +876,7 @@
|
|||
"task.database.index.commit": "Ejecutar la confirmación del índice de la base de datos",
|
||||
"task.database.index.ref": "Ejecutar referencia de índice de base de datos",
|
||||
"task.database.index.fix": "Ejecutar corrección del índice de la base de datos",
|
||||
"task.database.cache": "Ejecutar caché de base de datos",
|
||||
"task.ocr.image": "Ejecutar OCR de imagen para extraer texto",
|
||||
"task.history.generateDoc": "Ejecutar Historial GenerateDoc",
|
||||
"task.database.index.embedBlock": "Ejecutar bloque de incrustación de índice de base de datos",
|
||||
|
|
|
@ -876,6 +876,7 @@
|
|||
"task.database.index.commit": "Effectuer la validation de l'index de la base de données",
|
||||
"task.database.index.ref": "Exécuter la référence d'index de la base de données",
|
||||
"task.database.index.fix": "Effectuer la correction de l'index de la base de données",
|
||||
"task.database.cache": "Effectuer le cache de la base de données",
|
||||
"task.ocr.image": "Exécute l'OCR d'image pour extraire le texte",
|
||||
"task.history.generateDoc": "Exécuter l'historique de GenerateDoc",
|
||||
"task.database.index.embedBlock": "Exécuter le bloc d'intégration d'index de base de données",
|
||||
|
|
|
@ -876,6 +876,7 @@
|
|||
"task.database.index.commit": "執行數據庫索引提交",
|
||||
"task.database.index.ref": "執行數據庫索引引用",
|
||||
"task.database.index.fix": "執行數據庫索引訂正",
|
||||
"task.database.cache": "執行數據庫緩存",
|
||||
"task.ocr.image": "執行圖片 OCR 提取文本",
|
||||
"task.history.generateDoc": "執行生成文件歷史",
|
||||
"task.database.index.embedBlock": "執行數據庫索引嵌入塊",
|
||||
|
|
|
@ -876,6 +876,7 @@
|
|||
"task.database.index.commit": "执行数据库索引提交",
|
||||
"task.database.index.ref": "执行数据库索引引用",
|
||||
"task.database.index.fix": "执行数据库索引订正",
|
||||
"task.database.cache": "执行数据库缓存",
|
||||
"task.ocr.image": "执行图片 OCR 提取文本",
|
||||
"task.history.generateDoc": "执行生成文件历史",
|
||||
"task.database.index.embedBlock": "执行数据库索引嵌入块",
|
||||
|
|
|
@ -506,6 +506,9 @@ func ReloadUI() {
|
|||
|
||||
func FullReindex() {
|
||||
task.PrependTask(task.DatabaseIndexFull, fullReindex)
|
||||
task.AppendTask(task.DatabaseCache, sql.EnableCache)
|
||||
task.AppendTask(task.DatabaseIndexRef, IndexRefs)
|
||||
task.AppendTask(task.ReloadUI, util.ReloadUI)
|
||||
}
|
||||
|
||||
func fullReindex() {
|
||||
|
@ -523,12 +526,9 @@ func fullReindex() {
|
|||
for _, openedBox := range openedBoxes {
|
||||
index(openedBox.ID)
|
||||
}
|
||||
sql.EnableCache()
|
||||
treenode.SaveBlockTree(true)
|
||||
LoadFlashcards()
|
||||
IndexRefs()
|
||||
debug.FreeOSMemory()
|
||||
util.ReloadUI()
|
||||
}
|
||||
|
||||
func ChangeBoxSort(boxIDs []string) {
|
||||
|
|
|
@ -244,7 +244,6 @@ func RollbackDocHistory(boxID, historyPath string) (err error) {
|
|||
|
||||
FullReindex()
|
||||
IncSync()
|
||||
ReloadUI()
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
@ -441,7 +441,6 @@ func ImportData(zipPath string) (err error) {
|
|||
|
||||
IncSync()
|
||||
FullReindex()
|
||||
ReloadUI()
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -541,7 +541,6 @@ func checkoutRepo(id string) {
|
|||
}
|
||||
|
||||
FullReindex()
|
||||
ReloadUI()
|
||||
|
||||
if syncEnabled {
|
||||
func() {
|
||||
|
@ -1028,9 +1027,6 @@ func syncRepo(exit, byHand bool) (err error) {
|
|||
cache.ClearDocsIAL() // 同步后文档树文档图标没有更新 https://github.com/siyuan-note/siyuan/issues/4939
|
||||
if needFullReindex(upsertTrees) { // 改进同步后全量重建索引判断 https://github.com/siyuan-note/siyuan/issues/5764
|
||||
FullReindex()
|
||||
if !exit {
|
||||
ReloadUI()
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -97,7 +97,9 @@ func SyncData(boot, exit, byHand bool) {
|
|||
func syncData(boot, exit, byHand bool) {
|
||||
defer logging.Recover()
|
||||
|
||||
util.BroadcastByType("main", "syncing", 0, Conf.Language(81), nil)
|
||||
if !checkSync(boot, exit, byHand) {
|
||||
util.BroadcastByType("main", "syncing", 1, "", nil)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -118,7 +120,6 @@ func syncData(boot, exit, byHand bool) {
|
|||
now := util.CurrentTimeMillis()
|
||||
Conf.Sync.Synced = now
|
||||
|
||||
util.BroadcastByType("main", "syncing", 0, Conf.Language(81), nil)
|
||||
err := syncRepo(exit, byHand)
|
||||
synced := util.Millisecond2Time(Conf.Sync.Synced).Format("2006-01-02 15:04:05") + "\n\n"
|
||||
if nil == err {
|
||||
|
|
|
@ -79,6 +79,7 @@ const (
|
|||
DatabaseIndexCommit = "task.database.index.commit" // 数据库索引提交
|
||||
DatabaseIndexRef = "task.database.index.ref" // 数据库索引引用
|
||||
DatabaseIndexFix = "task.database.index.fix" // 数据库索引订正
|
||||
DatabaseCache = "task.database.cache" // 数据库缓存
|
||||
OCRImage = "task.ocr.image" // 图片 OCR 提取文本
|
||||
HistoryGenerateDoc = "task.history.generateDoc" // 生成文件历史
|
||||
DatabaseIndexEmbedBlock = "task.database.index.embedBlock" // 数据库索引嵌入块
|
||||
|
@ -105,8 +106,8 @@ func StatusJob() {
|
|||
for _, task := range tasks {
|
||||
actionLangs := util.TaskActionLangs[util.Lang]
|
||||
action := task.Action
|
||||
if c := count[action]; 3 < c {
|
||||
logging.LogWarnf("too many tasks [%s], ignore show its status", action)
|
||||
if c := count[action]; 2 < c {
|
||||
//logging.LogWarnf("too many tasks [%s], ignore show its status", action)
|
||||
continue
|
||||
}
|
||||
count[action]++
|
||||
|
@ -165,7 +166,7 @@ func execTask(task *Task) {
|
|||
}
|
||||
}
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.Background(), time.Second*7)
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)
|
||||
defer cancel()
|
||||
ch := make(chan bool, 1)
|
||||
go func() {
|
||||
|
@ -175,7 +176,7 @@ func execTask(task *Task) {
|
|||
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
//logging.LogWarnf("task [%s] timeout", task.Action)
|
||||
logging.LogWarnf("task [%s] timeout", task.Action)
|
||||
case <-ch:
|
||||
//logging.LogInfof("task [%s] done", task.Action)
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue