mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-05-04 22:06:06 +02:00
improve avatar time spent loading performance by fetching all times in one query
This commit is contained in:
@@ -53,6 +53,18 @@ const avatarFavorites = {
|
||||
return ref;
|
||||
},
|
||||
|
||||
async getAllAvatarTimeSpent() {
|
||||
const map = new Map();
|
||||
await sqliteService.execute(
|
||||
(row) => {
|
||||
map.set(row[0], row[1] || 0);
|
||||
},
|
||||
`SELECT avatar_id, time FROM ${dbVars.userPrefix}_avatar_history`
|
||||
);
|
||||
|
||||
return map;
|
||||
},
|
||||
|
||||
addAvatarTimeSpent(avatarId, timeSpent) {
|
||||
sqliteService.executeNonQuery(
|
||||
`UPDATE ${dbVars.userPrefix}_avatar_history SET time = time + @timeSpent WHERE avatar_id = @avatarId`,
|
||||
|
||||
Reference in New Issue
Block a user