mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-27 17:34:06 +01:00
🎨 Improve history database index https://github.com/siyuan-note/siyuan/issues/8506
This commit is contained in:
parent
eb941b36e4
commit
073af9a310
9 changed files with 16 additions and 8 deletions
|
|
@ -96,12 +96,7 @@ func reindexHistory(c *gin.Context) {
|
|||
ret := gulu.Ret.NewResult()
|
||||
defer c.JSON(http.StatusOK, ret)
|
||||
|
||||
err := model.ReindexHistory()
|
||||
if nil != err {
|
||||
ret.Code = -1
|
||||
ret.Msg = err.Error()
|
||||
return
|
||||
}
|
||||
model.ReindexHistory()
|
||||
}
|
||||
|
||||
func getNotebookHistory(c *gin.Context) {
|
||||
|
|
|
|||
|
|
@ -564,7 +564,12 @@ func getHistoryDir(suffix string, t time.Time) (ret string, err error) {
|
|||
return
|
||||
}
|
||||
|
||||
func ReindexHistory() (err error) {
|
||||
func ReindexHistory() {
|
||||
task.AppendTask(task.HistoryDatabaseIndexFull, fullReindexHistory)
|
||||
return
|
||||
}
|
||||
|
||||
func fullReindexHistory() {
|
||||
historyDirs, err := os.ReadDir(util.HistoryDir)
|
||||
if nil != err {
|
||||
logging.LogErrorf("read history dir [%s] failed: %s", util.HistoryDir, err)
|
||||
|
|
|
|||
|
|
@ -83,7 +83,8 @@ func FlushHistoryQueue() {
|
|||
if err = execHistoryOp(op, tx, context); nil != err {
|
||||
tx.Rollback()
|
||||
logging.LogErrorf("queue operation failed: %s", err)
|
||||
continue
|
||||
util.PushMsg("History database index failed, please try to manually rebuild it in [Data history - File history]", 5000)
|
||||
return
|
||||
}
|
||||
|
||||
if err = commitHistoryTx(tx); nil != err {
|
||||
|
|
|
|||
|
|
@ -90,6 +90,7 @@ const (
|
|||
DatabaseIndexFix = "task.database.index.fix" // 数据库索引订正
|
||||
OCRImage = "task.ocr.image" // 图片 OCR 提取文本
|
||||
HistoryGenerateDoc = "task.history.generateDoc" // 生成文件历史
|
||||
HistoryDatabaseIndexFull = "task.history.database.index.full" // 历史数据库重建索引
|
||||
HistoryDatabaseIndexCommit = "task.history.database.index.commit" // 历史数据库索引提交
|
||||
DatabaseIndexEmbedBlock = "task.database.index.embedBlock" // 数据库索引嵌入块
|
||||
ReloadUI = "task.reload.ui" // 重载 UI
|
||||
|
|
@ -103,6 +104,7 @@ var uniqueActions = []string{
|
|||
DatabaseIndexCommit,
|
||||
OCRImage,
|
||||
HistoryGenerateDoc,
|
||||
HistoryDatabaseIndexFull,
|
||||
HistoryDatabaseIndexCommit,
|
||||
DatabaseIndexEmbedBlock,
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue