This commit is contained in:
Liang Ding 2022-11-22 10:38:13 +08:00
parent 31be236557
commit 8652c4cef7
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
2 changed files with 7 additions and 1 deletions

View file

@ -160,7 +160,9 @@ func BookmarkLabels() (ret []string) {
func BuildBookmark() (ret *Bookmarks) { func BuildBookmark() (ret *Bookmarks) {
WaitForWritingFiles() WaitForWritingFiles()
sql.WaitForWritingDatabase() if !sql.IsEmptyQueue() {
sql.WaitForWritingDatabase()
}
ret = &Bookmarks{} ret = &Bookmarks{}
sqlBlocks := sql.QueryBookmarkBlocks() sqlBlocks := sql.QueryBookmarkBlocks()

View file

@ -81,6 +81,10 @@ func isWritingDatabase() bool {
return false return false
} }
func IsEmptyQueue() bool {
return 1 > len(operationQueue) && !util.IsMutexLocked(&txLock)
}
func flushTreeQueue() { func flushTreeQueue() {
ops := mergeUpsertTrees() ops := mergeUpsertTrees()
if 1 > len(ops) { if 1 > len(ops) {