From d97c5b894a0a1fa2edf34d395c2b4a24c7720b3d Mon Sep 17 00:00:00 2001 From: Chubby Granny Chaser Date: Sun, 22 Sep 2024 17:44:06 +0100 Subject: [PATCH] feat: adding dexie --- src/renderer/src/workers/migration.worker.ts | 32 ++++++++------------ 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/src/renderer/src/workers/migration.worker.ts b/src/renderer/src/workers/migration.worker.ts index b4c9f3c7..e6a66b2a 100644 --- a/src/renderer/src/workers/migration.worker.ts +++ b/src/renderer/src/workers/migration.worker.ts @@ -1,43 +1,35 @@ -import { db, downloadSourcesTable, repacksTable } from "@renderer/dexie"; +// import { db, downloadSourcesTable, repacksTable } from "@renderer/dexie"; import { DownloadSource, GameRepack } from "@types"; export type Payload = [DownloadSource[], GameRepack[]]; -self.onmessage = async (event: MessageEvent) => { - const [downloadSources, gameRepacks] = event.data; - - const downloadSourcesCount = await downloadSourcesTable.count(); - - if (downloadSources.length > downloadSourcesCount) { - await db.transaction( - "rw", - downloadSourcesTable, - repacksTable, - async () => {} - ); - } - +self.onmessage = async (_event: MessageEvent) => { + // const [downloadSources, gameRepacks] = event.data; + // const downloadSourcesCount = await downloadSourcesTable.count(); + // if (downloadSources.length > downloadSourcesCount) { + // await db.transaction( + // "rw", + // downloadSourcesTable, + // repacksTable, + // async () => {} + // ); + // } // if (type === "MIGRATE_DOWNLOAD_SOURCES") { // const dexieDownloadSources = await downloadSourcesTable.count(); - // if (data.length > dexieDownloadSources) { // await downloadSourcesTable.clear(); // await downloadSourcesTable.bulkAdd(data); // } - // self.postMessage("MIGRATE_DOWNLOAD_SOURCES_COMPLETE"); // } - // if (type === "MIGRATE_REPACKS") { // const dexieRepacks = await repacksTable.count(); - // if (data.length > dexieRepacks) { // await repacksTable.clear(); // await repacksTable.bulkAdd( // data.map((repack) => ({ ...repack, uris: JSON.stringify(repack.uris) })) // ); // } - // self.postMessage("MIGRATE_REPACKS_COMPLETE"); // } };