mirror of
https://github.com/vrcx-team/VRCX.git
synced 2026-04-06 00:32:02 +02:00
PRAGMA optimize
This commit is contained in:
@@ -34,7 +34,7 @@ namespace VRCX
|
||||
if (!string.IsNullOrEmpty(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();
|
||||
}
|
||||
|
||||
@@ -18132,6 +18132,7 @@ console.log(`isLinux: ${LINUX}`);
|
||||
await database.fixBrokenGameLogDisplayNames(); // fix gameLog display names "DisplayName (userId)"
|
||||
await database.upgradeDatabaseVersion(); // update database version
|
||||
await database.vacuum(); // succ
|
||||
await database.optimize();
|
||||
await configRepository.setInt(
|
||||
'VRCX_databaseVersion',
|
||||
databaseVersion
|
||||
|
||||
@@ -24,7 +24,8 @@ export default class extends baseClass {
|
||||
nextDiscordUpdate: 0,
|
||||
nextAutoStateChange: 0,
|
||||
nextGetLogCheck: 0,
|
||||
nextGameRunningCheck: 0
|
||||
nextGameRunningCheck: 0,
|
||||
nextDatabaseOptimize: 3600
|
||||
};
|
||||
|
||||
_methods = {
|
||||
@@ -105,6 +106,10 @@ export default class extends baseClass {
|
||||
AppApi.CheckGameRunning();
|
||||
}
|
||||
}
|
||||
if (--this.nextDatabaseOptimize <= 0) {
|
||||
this.nextDatabaseOptimize = 86400; // 1 day
|
||||
database.optimize();
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
API.isRefreshFriendsLoading = false;
|
||||
|
||||
@@ -2754,6 +2754,10 @@ class Database {
|
||||
await sqliteService.executeNonQuery('VACUUM');
|
||||
}
|
||||
|
||||
async optimize() {
|
||||
await sqliteService.executeNonQuery('PRAGMA optimize');
|
||||
}
|
||||
|
||||
async getInstanceJoinHistory() {
|
||||
var oneWeekAgo = new Date(Date.now() - 604800000).toJSON();
|
||||
var instances = new Map();
|
||||
|
||||
Reference in New Issue
Block a user