mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-24 02:20:13 +01:00
This commit is contained in:
parent
91674399d8
commit
fa1ee8f4a1
3 changed files with 24 additions and 15 deletions
|
|
@ -19,6 +19,7 @@ package model
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/siyuan-note/eventbus"
|
||||
"io/fs"
|
||||
"math"
|
||||
"os"
|
||||
|
|
@ -575,13 +576,15 @@ func ReindexHistory() (err error) {
|
|||
|
||||
sql.InitHistoryDatabase(true)
|
||||
lutEngine := util.NewLute()
|
||||
|
||||
context := map[string]interface{}{eventbus.CtxPushMsg: eventbus.CtxPushMsgToStatusBarAndProgress}
|
||||
for _, historyDir := range historyDirs {
|
||||
if !historyDir.IsDir() {
|
||||
continue
|
||||
}
|
||||
|
||||
name := historyDir.Name()
|
||||
indexHistoryDir(name, lutEngine)
|
||||
indexHistoryDirWithContext(name, lutEngine, context)
|
||||
}
|
||||
|
||||
sql.WaitForWritingHistoryDatabase()
|
||||
|
|
@ -597,6 +600,10 @@ const (
|
|||
)
|
||||
|
||||
func indexHistoryDir(name string, luteEngine *lute.Lute) {
|
||||
indexHistoryDirWithContext(name, luteEngine, map[string]interface{}{eventbus.CtxPushMsg: eventbus.CtxPushMsgToStatusBar})
|
||||
}
|
||||
|
||||
func indexHistoryDirWithContext(name string, luteEngine *lute.Lute, context map[string]interface{}) {
|
||||
defer logging.Recover()
|
||||
|
||||
op := name[strings.LastIndex(name, "-")+1:]
|
||||
|
|
@ -660,7 +667,7 @@ func indexHistoryDir(name string, luteEngine *lute.Lute) {
|
|||
})
|
||||
}
|
||||
|
||||
sql.IndexHistoriesQueue(histories)
|
||||
sql.IndexHistoriesQueue(histories, context)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue