🎨 改进内核任务调度机制提升稳定性 https://github.com/siyuan-note/siyuan/issues/7113

This commit is contained in:
Liang Ding 2023-01-26 13:58:58 +08:00
parent e214543c86
commit 81df07598d
No known key found for this signature in database
GPG key ID: 136F30F901A2231D

View file

@ -19,7 +19,7 @@ package treenode
import (
"io"
"os"
"runtime/debug"
"runtime"
"strings"
"sync"
"time"
@ -353,7 +353,7 @@ func InitBlockTree(force bool) {
return
}
blockTreesLock.Unlock()
debug.FreeOSMemory()
runtime.GC()
if elapsed := time.Since(start).Seconds(); 2 < elapsed {
logging.LogWarnf("read block tree [%s] to [%s], elapsed [%.2fs]", humanize.Bytes(uint64(len(data))), util.BlockTreePath, elapsed)
@ -385,7 +385,7 @@ func SaveBlockTree(force bool) {
os.Exit(util.ExitCodeBlockTreeErr)
return
}
debug.FreeOSMemory()
runtime.GC()
if elapsed := time.Since(start).Seconds(); 2 < elapsed {
logging.LogWarnf("save block tree [size=%s] to [%s], elapsed [%.2fs]", humanize.Bytes(uint64(len(data))), util.BlockTreePath, elapsed)