mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-19 14:53:50 +02:00
PRAGMA optimize
This commit is contained in:
@@ -34,7 +34,7 @@ namespace VRCX
|
|||||||
if (!string.IsNullOrEmpty(jsonDataSource))
|
if (!string.IsNullOrEmpty(jsonDataSource))
|
||||||
dataSource = jsonDataSource;
|
dataSource = jsonDataSource;
|
||||||
|
|
||||||
m_Connection = new SQLiteConnection($"Data Source=\"{dataSource}\";Version=3;PRAGMA locking_mode=NORMAL;PRAGMA busy_timeout=5000;PRAGMA journal_mode=WAL;", true);
|
m_Connection = new SQLiteConnection($"Data Source=\"{dataSource}\";Version=3;PRAGMA locking_mode=NORMAL;PRAGMA busy_timeout=5000;PRAGMA journal_mode=WAL;PRAGMA optimize=0x10002;", true);
|
||||||
|
|
||||||
m_Connection.Open();
|
m_Connection.Open();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18132,6 +18132,7 @@ console.log(`isLinux: ${LINUX}`);
|
|||||||
await database.fixBrokenGameLogDisplayNames(); // fix gameLog display names "DisplayName (userId)"
|
await database.fixBrokenGameLogDisplayNames(); // fix gameLog display names "DisplayName (userId)"
|
||||||
await database.upgradeDatabaseVersion(); // update database version
|
await database.upgradeDatabaseVersion(); // update database version
|
||||||
await database.vacuum(); // succ
|
await database.vacuum(); // succ
|
||||||
|
await database.optimize();
|
||||||
await configRepository.setInt(
|
await configRepository.setInt(
|
||||||
'VRCX_databaseVersion',
|
'VRCX_databaseVersion',
|
||||||
databaseVersion
|
databaseVersion
|
||||||
|
|||||||
@@ -24,7 +24,8 @@ export default class extends baseClass {
|
|||||||
nextDiscordUpdate: 0,
|
nextDiscordUpdate: 0,
|
||||||
nextAutoStateChange: 0,
|
nextAutoStateChange: 0,
|
||||||
nextGetLogCheck: 0,
|
nextGetLogCheck: 0,
|
||||||
nextGameRunningCheck: 0
|
nextGameRunningCheck: 0,
|
||||||
|
nextDatabaseOptimize: 3600
|
||||||
};
|
};
|
||||||
|
|
||||||
_methods = {
|
_methods = {
|
||||||
@@ -105,6 +106,10 @@ export default class extends baseClass {
|
|||||||
AppApi.CheckGameRunning();
|
AppApi.CheckGameRunning();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (--this.nextDatabaseOptimize <= 0) {
|
||||||
|
this.nextDatabaseOptimize = 86400; // 1 day
|
||||||
|
database.optimize();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
API.isRefreshFriendsLoading = false;
|
API.isRefreshFriendsLoading = false;
|
||||||
|
|||||||
@@ -2754,6 +2754,10 @@ class Database {
|
|||||||
await sqliteService.executeNonQuery('VACUUM');
|
await sqliteService.executeNonQuery('VACUUM');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async optimize() {
|
||||||
|
await sqliteService.executeNonQuery('PRAGMA optimize');
|
||||||
|
}
|
||||||
|
|
||||||
async getInstanceJoinHistory() {
|
async getInstanceJoinHistory() {
|
||||||
var oneWeekAgo = new Date(Date.now() - 604800000).toJSON();
|
var oneWeekAgo = new Date(Date.now() - 604800000).toJSON();
|
||||||
var instances = new Map();
|
var instances = new Map();
|
||||||
|
|||||||
Reference in New Issue
Block a user