Skip to content

Commit

Permalink
perf(auth): remove unused accounts when saving
Browse files Browse the repository at this point in the history
  • Loading branch information
skjsjhb committed Mar 2, 2025
1 parent 3969f7d commit 024c111
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/main/registry/registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,20 +132,28 @@ async function close() {
}

/**
* Remove unreachable containers.
* Remove unreachable containers and accounts.
*/
function purgeRegistries() {
const usedContainers = new Set<string>();
const usedAccounts = new Set<string>();

for (const g of reg.games.getAll()) {
usedContainers.add(g.launchHint.containerId);
usedAccounts.add(g.launchHint.accountId);
}

for (const k of reg.containers.keys()) {
if (!usedContainers.has(k)) {
reg.containers.remove(k);
}
}

for (const k of reg.accounts.keys()) {
if (!usedAccounts.has(k)) {
reg.accounts.remove(k);
}
}
}

export const registry = {
Expand Down

0 comments on commit 024c111

Please sign in to comment.