mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-22 00:06:09 +01:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
4103b380ab
14 changed files with 43 additions and 18 deletions
|
|
@ -995,7 +995,7 @@
|
|||
"105": "Corrupted data repo have been automatically reset",
|
||||
"106": "Maximum length is limited to 512 characters",
|
||||
"107": "Moving document [%s]",
|
||||
"108": "Rebuild index complete",
|
||||
"108": "TODO",
|
||||
"109": "Remove reminder completed [%s]",
|
||||
"110": "Renaming...",
|
||||
"111": "Saving document [%s]...",
|
||||
|
|
|
|||
|
|
@ -995,7 +995,7 @@
|
|||
"105": "El repositorio de datos corruptos se ha restablecido automáticamente",
|
||||
"106": "La longitud máxima está limitada a 512 caracteres",
|
||||
"107": "Moviendo documento [%s]",
|
||||
"108": "Reconstrucción del índice completada",
|
||||
"108": "TODO",
|
||||
"109": "Eliminación de recordatorios completada [%s]",
|
||||
"110": "Renombrar...",
|
||||
"111": "Guardando documento [%s]...",
|
||||
|
|
|
|||
|
|
@ -995,7 +995,7 @@
|
|||
"105": "Le référentiel de données corrompu a été automatiquement réinitialisé",
|
||||
"106": "La longueur maximale est limitée à 512 caractères",
|
||||
"107": "Déplacement du document [%s]",
|
||||
"108": "Reconstruire l'index terminé",
|
||||
"108": "TODO",
|
||||
"109": "Supprimer le rappel terminé [%s]",
|
||||
"110": "Renommer...",
|
||||
"111": "Enregistrement du document [%s]...",
|
||||
|
|
|
|||
|
|
@ -995,7 +995,7 @@
|
|||
"105": "已經自動重置損壞的數據倉庫",
|
||||
"106": "最大長度限制為 512 字元",
|
||||
"107": "正在移動文檔 [%s]",
|
||||
"108": "重建索引完畢",
|
||||
"108": "TODO",
|
||||
"109": "移除提醒完畢 [%s]",
|
||||
"110": "正在重命名...",
|
||||
"111": "正在保存文檔 [%s]...",
|
||||
|
|
|
|||
|
|
@ -995,7 +995,7 @@
|
|||
"105": "已经自动重置损坏的数据仓库",
|
||||
"106": "最大长度限制为 512 字符",
|
||||
"107": "正在移动文档 [%s]",
|
||||
"108": "重建索引完毕",
|
||||
"108": "TODO",
|
||||
"109": "移除提醒完毕 [%s]",
|
||||
"110": "正在重命名...",
|
||||
"111": "正在保存文档 [%s]...",
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ import (
|
|||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"runtime/debug"
|
||||
"sort"
|
||||
"strings"
|
||||
"sync"
|
||||
|
|
@ -517,11 +517,10 @@ func fullReindex() {
|
|||
sql.EnableCache()
|
||||
treenode.SaveBlockTree(true)
|
||||
LoadFlashcards()
|
||||
runtime.GC()
|
||||
debug.FreeOSMemory()
|
||||
go func() {
|
||||
time.Sleep(3 * time.Second)
|
||||
util.PushClearMsg(msgId)
|
||||
util.PushStatusBar(Conf.Language(108))
|
||||
}()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ import (
|
|||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"runtime/debug"
|
||||
"sort"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
|
@ -700,7 +700,7 @@ func ImportFromLocalPath(boxID, localPath string, toPath string) (err error) {
|
|||
|
||||
IncSync()
|
||||
util.ReloadUI()
|
||||
runtime.GC()
|
||||
debug.FreeOSMemory()
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ package model
|
|||
import (
|
||||
"fmt"
|
||||
"runtime"
|
||||
"runtime/debug"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
|
@ -125,7 +126,7 @@ func index(boxID string) {
|
|||
end := time.Now()
|
||||
elapsed := end.Sub(start).Seconds()
|
||||
logging.LogInfof("rebuilt database for notebook [%s] in [%.2fs], tree [count=%d, size=%s]", box.ID, elapsed, treeCount, humanize.Bytes(uint64(treeSize)))
|
||||
runtime.GC()
|
||||
debug.FreeOSMemory()
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import (
|
|||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"runtime/debug"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
|
@ -148,6 +149,7 @@ func autoFixIndex() {
|
|||
util.PushStatusBar(Conf.Language(58))
|
||||
sql.WaitForWritingDatabase()
|
||||
util.PushStatusBar(Conf.Language(185))
|
||||
debug.FreeOSMemory()
|
||||
}
|
||||
|
||||
func reindexTreeByUpdated(rootUpdatedMap, dbRootUpdatedMap map[string]string) {
|
||||
|
|
|
|||
|
|
@ -55,12 +55,15 @@ func HookDesktopUIProcJob() {
|
|||
}
|
||||
|
||||
if 0 < util.CountSessions() {
|
||||
// 如果存在活动的会话则说明 UI 进程还在运行
|
||||
return
|
||||
}
|
||||
|
||||
uiProcNames := []string{"siyuan", "electron"}
|
||||
uiProcessCount := 0
|
||||
util.UIProcessIDs.Range(func(uiProcIDArg, _ interface{}) bool {
|
||||
// 从 UI 进程 ID 列表中找到 UI 进程
|
||||
|
||||
uiProcessCount++
|
||||
uiProcID, err := strconv.Atoi(uiProcIDArg.(string))
|
||||
if nil != err {
|
||||
|
|
@ -89,8 +92,25 @@ func HookDesktopUIProcJob() {
|
|||
}
|
||||
return true
|
||||
})
|
||||
|
||||
if 1 > uiProcessCount {
|
||||
noUIProcCount++
|
||||
// 如果 UI 进程 ID 列表中没有找到 UI 进程则从完整的进程列表中找
|
||||
procs, _ := goPS.Processes()
|
||||
for _, proc := range procs {
|
||||
procName := strings.ToLower(proc.Executable())
|
||||
uiProcOk := false
|
||||
for _, name := range uiProcNames {
|
||||
uiProcOk = strings.Contains(procName, name)
|
||||
}
|
||||
if uiProcOk {
|
||||
uiProcessCount++
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if 1 > uiProcessCount {
|
||||
noUIProcCount++
|
||||
}
|
||||
}
|
||||
|
||||
if 0 < noUIProcCount {
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
package sql
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
"runtime/debug"
|
||||
"time"
|
||||
|
||||
"github.com/88250/lute/ast"
|
||||
|
|
@ -45,7 +45,7 @@ func DisableCache() {
|
|||
|
||||
func ClearBlockCache() {
|
||||
memCache.Clear()
|
||||
runtime.GC()
|
||||
debug.FreeOSMemory()
|
||||
}
|
||||
|
||||
func putBlockCache(block *Block) {
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ import (
|
|||
"path/filepath"
|
||||
"regexp"
|
||||
"runtime"
|
||||
"runtime/debug"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
|
@ -1267,6 +1268,7 @@ func closeDatabase() (err error) {
|
|||
}
|
||||
|
||||
err = db.Close()
|
||||
debug.FreeOSMemory()
|
||||
runtime.GC() // 没有这句的话文件句柄不会释放,后面就无法删除文件
|
||||
return
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
"path"
|
||||
"runtime"
|
||||
"runtime/debug"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
|
|
@ -128,12 +128,12 @@ func FlushQueue() {
|
|||
}
|
||||
|
||||
if 16 < i && 0 == i%128 {
|
||||
runtime.GC()
|
||||
debug.FreeOSMemory()
|
||||
}
|
||||
}
|
||||
|
||||
if 128 < len(ops) {
|
||||
runtime.GC()
|
||||
debug.FreeOSMemory()
|
||||
}
|
||||
|
||||
elapsed := time.Now().Sub(start).Milliseconds()
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import (
|
|||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"runtime/debug"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
|
@ -380,7 +381,7 @@ func InitBlockTree(force bool) {
|
|||
waitGroup.Wait()
|
||||
p.Release()
|
||||
|
||||
runtime.GC()
|
||||
debug.FreeOSMemory()
|
||||
elapsed := time.Since(start).Seconds()
|
||||
logging.LogInfof("read block tree [%s] to [%s], elapsed [%.2fs]", humanize.Bytes((size)), util.BlockTreePath, elapsed)
|
||||
return
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue