mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 15:10:12 +01:00
🎨 重建索引前清空数据库队列
This commit is contained in:
parent
3f1cbb2d1d
commit
248eecb871
2 changed files with 7 additions and 0 deletions
|
|
@ -64,6 +64,7 @@ func InitDatabase(forceRebuild bool) (err error) {
|
||||||
util.IncBootProgress(2, "Initializing database...")
|
util.IncBootProgress(2, "Initializing database...")
|
||||||
|
|
||||||
if forceRebuild {
|
if forceRebuild {
|
||||||
|
ClearQueue()
|
||||||
WaitForWritingDatabase()
|
WaitForWritingDatabase()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -85,6 +85,12 @@ func IsEmptyQueue() bool {
|
||||||
return 1 > len(operationQueue) && !util.IsMutexLocked(&txLock)
|
return 1 > len(operationQueue) && !util.IsMutexLocked(&txLock)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func ClearQueue() {
|
||||||
|
upsertTreeQueueLock.Lock()
|
||||||
|
defer upsertTreeQueueLock.Unlock()
|
||||||
|
operationQueue = nil
|
||||||
|
}
|
||||||
|
|
||||||
func flushTreeQueue() {
|
func flushTreeQueue() {
|
||||||
ops := mergeUpsertTrees()
|
ops := mergeUpsertTrees()
|
||||||
if 1 > len(ops) {
|
if 1 > len(ops) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue