Fix: Wait for busy lock instead of instantly dropping the operation

This commit is contained in:
relikd
2020-08-24 00:58:50 +02:00
parent 8855ae754a
commit 52fa2e460e

View File

@@ -48,6 +48,7 @@ class SQLiteDatabase {
static func open(path: String = URL.internalDB().relativePath) throws -> SQLiteDatabase {
var db: OpaquePointer?
if sqlite3_open_v2(path, &db, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE | SQLITE_OPEN_FULLMUTEX, nil) == SQLITE_OK {
sqlite3_busy_timeout(db, 800)
return SQLiteDatabase(dbPointer: db)
} else {
defer { sqlite3_close_v2(db) }