mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 22:50:13 +01:00
🎨 Improve file read/write locking https://github.com/siyuan-note/siyuan/issues/9748
This commit is contained in:
parent
4347d12af0
commit
b1cea465ac
8 changed files with 31 additions and 35 deletions
|
|
@ -20,6 +20,7 @@ import (
|
|||
"database/sql"
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/88250/gulu"
|
||||
"path"
|
||||
"runtime/debug"
|
||||
"sync"
|
||||
|
|
@ -75,14 +76,14 @@ func WaitForWritingDatabase() {
|
|||
|
||||
func isWritingDatabase() bool {
|
||||
time.Sleep(util.SQLFlushInterval + 50*time.Millisecond)
|
||||
if 0 < len(operationQueue) || util.IsMutexLocked(&txLock) {
|
||||
if 0 < len(operationQueue) || gulu.IsMutexLocked(&txLock) {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func IsEmptyQueue() bool {
|
||||
return 1 > len(operationQueue) && !util.IsMutexLocked(&txLock)
|
||||
return 1 > len(operationQueue) && !gulu.IsMutexLocked(&txLock)
|
||||
}
|
||||
|
||||
func ClearQueue() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue