mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 07:00:12 +01:00
🐛 退出应用时数据库未完全写入 https://github.com/siyuan-note/siyuan/issues/6318
This commit is contained in:
parent
4ae5698ea6
commit
db04bfa572
5 changed files with 27 additions and 12 deletions
|
|
@ -32,10 +32,6 @@ import (
|
|||
"github.com/siyuan-note/siyuan/kernel/util"
|
||||
)
|
||||
|
||||
const (
|
||||
upsertTreesFlushDelay = 3000
|
||||
)
|
||||
|
||||
var (
|
||||
operationQueue []*treeQueueOperation
|
||||
upsertTreeQueueLock = sync.Mutex{}
|
||||
|
|
@ -57,7 +53,7 @@ type treeQueueOperation struct {
|
|||
func AutoFlushTreeQueue() {
|
||||
for {
|
||||
flushTreeQueue()
|
||||
time.Sleep(time.Duration(upsertTreesFlushDelay) * time.Millisecond)
|
||||
time.Sleep(util.SQLFlushInterval)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -78,7 +74,7 @@ func WaitForWritingDatabase() {
|
|||
}
|
||||
|
||||
func isWritingDatabase() bool {
|
||||
time.Sleep(time.Duration(upsertTreesFlushDelay+50) * time.Millisecond)
|
||||
time.Sleep(util.SQLFlushInterval + 50*time.Millisecond)
|
||||
if 0 < len(operationQueue) || util.IsMutexLocked(&txLock) {
|
||||
return true
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue