mirror of
https://github.com/tnodir/fort
synced 2024-11-15 08:46:03 +00:00
UI: SqliteDb: Set default busy handler timeout
This commit is contained in:
parent
9369484f00
commit
f5550751ad
4
src/ui/3rdparty/sqlite/sqlitedb.cpp
vendored
4
src/ui/3rdparty/sqlite/sqlitedb.cpp
vendored
@ -14,6 +14,8 @@ namespace {
|
||||
|
||||
const QLoggingCategory LC("db");
|
||||
|
||||
constexpr int DATABASE_BUSY_TIMEOUT = 2000; // 2 seconds
|
||||
|
||||
const char *const defaultSqlPragmas = "PRAGMA journal_mode = WAL;"
|
||||
"PRAGMA locking_mode = NORMAL;"
|
||||
"PRAGMA synchronous = NORMAL;"
|
||||
@ -333,6 +335,8 @@ QStringList SqliteDb::columnNames(const QString &tableName, const QString &schem
|
||||
|
||||
bool SqliteDb::migrate(MigrateOptions &opt)
|
||||
{
|
||||
setBusyTimeoutMs(DATABASE_BUSY_TIMEOUT);
|
||||
|
||||
if (!opt.sqlPragmas) {
|
||||
opt.sqlPragmas = defaultSqlPragmas;
|
||||
}
|
||||
|
@ -20,8 +20,6 @@ const QLoggingCategory LC("statBlock");
|
||||
|
||||
constexpr int DATABASE_USER_VERSION = 7;
|
||||
|
||||
constexpr int DATABASE_BUSY_TIMEOUT = 3000; // 3 seconds
|
||||
|
||||
bool migrateFunc(SqliteDb *db, int version, bool isNewDb, void *ctx)
|
||||
{
|
||||
Q_UNUSED(ctx);
|
||||
@ -191,12 +189,8 @@ bool StatBlockManager::setupDb()
|
||||
<< roSqliteDb()->errorMessage();
|
||||
return false;
|
||||
}
|
||||
|
||||
roSqliteDb()->setBusyTimeoutMs(DATABASE_BUSY_TIMEOUT);
|
||||
}
|
||||
|
||||
sqliteDb()->setBusyTimeoutMs(DATABASE_BUSY_TIMEOUT);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user