feat: improving caching

This commit is contained in:
Chubby Granny Chaser
2025-10-15 16:02:50 +01:00
parent 074d9d4fe2
commit 5639c09c22
4 changed files with 5 additions and 7 deletions

View File

@@ -15,11 +15,9 @@ const addDownloadSource = async (
// Verify that repacks were actually written to the database (read-after-write)
// This ensures all async operations are complete before proceeding
let repackCount = 0;
const repackIds: number[] = [];
for await (const [, repack] of repacksSublevel.iterator()) {
if (repack.downloadSourceId === result.id) {
repackCount++;
repackIds.push(repack.id);
}
}

View File

@@ -2,7 +2,7 @@ import axios from "axios";
import { z } from "zod";
import { downloadSourcesSublevel, repacksSublevel } from "@main/level";
import { DownloadSourceStatus } from "@shared";
import crypto from "crypto";
import crypto from "node:crypto";
import { logger, ResourceCache } from "@main/services";
export const downloadSourceSchema = z.object({
@@ -62,9 +62,9 @@ export type FormattedSteamGamesByLetter = Record<string, FormattedSteamGame[]>;
export const formatName = (name: string) => {
return name
.normalize("NFD")
.replace(/[\u0300-\u036f]/g, "")
.replaceAll(/[\u0300-\u036f]/g, "")
.toLowerCase()
.replace(/[^a-z0-9]/g, "");
.replaceAll(/[^a-z0-9]/g, "");
};
export const formatRepackName = (name: string) => {

View File

@@ -1,6 +1,6 @@
import { registerEvent } from "../register-event";
import { gamesSublevel, gamesShopAssetsSublevel, levelKeys } from "@main/level";
import { randomUUID } from "crypto";
import { randomUUID } from "node:crypto";
import type { GameShop } from "@types";
const addCustomGameToLibrary = async (

View File

@@ -1,7 +1,7 @@
import { registerEvent } from "../register-event";
import fs from "node:fs";
import path from "node:path";
import { randomUUID } from "crypto";
import { randomUUID } from "node:crypto";
import { ASSETS_PATH } from "@main/constants";
const copyCustomGameAsset = async (