mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-26 10:16:10 +01:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
b1c871a3b2
2 changed files with 8 additions and 4 deletions
|
|
@ -429,6 +429,7 @@ func Close(force bool, execInstallPkg int) (exitCode int) {
|
|||
|
||||
Conf.Close()
|
||||
sql.CloseDatabase()
|
||||
treenode.SaveBlockTree()
|
||||
clearWorkspaceTemp()
|
||||
clearPortJSON()
|
||||
|
||||
|
|
|
|||
|
|
@ -254,10 +254,7 @@ func IndexBlockTree(tree *parse.Tree) {
|
|||
|
||||
func AutoFlushBlockTree() {
|
||||
for {
|
||||
if blockTreesChanged {
|
||||
SaveBlockTree()
|
||||
blockTreesChanged = false
|
||||
}
|
||||
SaveBlockTree()
|
||||
time.Sleep(7 * time.Second)
|
||||
}
|
||||
}
|
||||
|
|
@ -306,6 +303,10 @@ func InitBlockTree(force bool) {
|
|||
}
|
||||
|
||||
func SaveBlockTree() {
|
||||
if !blockTreesChanged {
|
||||
return
|
||||
}
|
||||
|
||||
start := time.Now()
|
||||
|
||||
blockTreesLock.Lock()
|
||||
|
|
@ -326,4 +327,6 @@ func SaveBlockTree() {
|
|||
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)
|
||||
}
|
||||
|
||||
blockTreesChanged = false
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue