🎨 Improve data indexing to reduce disk read operations https://github.com/siyuan-note/siyuan/issues/16958

Signed-off-by: Daniel <845765@qq.com>
This commit is contained in:
Daniel 2026-02-02 22:54:18 +08:00
parent 1da1c255f6
commit cc37ec4030
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
2 changed files with 7 additions and 2 deletions

View file

@ -46,6 +46,7 @@ func StartCron() {
go every(30*time.Second, model.HookDesktopUIProcJob)
go every(24*time.Hour, model.AutoPurgeRepoJob)
go every(30*time.Minute, model.AutoCheckMicrosoftDefenderJob)
go every(24*time.Hour, model.ClearOutdatedHistoryDirJob)
// TODO: 移除旧方案 https://github.com/siyuan-note/siyuan/issues/14414 实现新的刷新机制
//go every(3*time.Second, model.WatchLocalShorthands)

View file

@ -77,7 +77,6 @@ func GenerateFileHistory() {
generateAssetsHistory()
historyDir := util.HistoryDir
clearOutdatedHistoryDir(historyDir)
// 以下部分是老版本的历史数据,不再保留
for _, box := range Conf.GetBoxes() {
@ -683,7 +682,12 @@ func (box *Box) generateDocHistory0() {
return
}
func clearOutdatedHistoryDir(historyDir string) {
func ClearOutdatedHistoryDirJob() {
clearOutdatedHistoryDir()
}
func clearOutdatedHistoryDir() {
historyDir := util.HistoryDir
if !gulu.File.IsExist(historyDir) {
return
}