From e4f1abaa5a0261b0b19e59919d4f72055664de63 Mon Sep 17 00:00:00 2001 From: Zamitto <167933696+zamitto@users.noreply.github.com> Date: Thu, 20 Jun 2024 00:01:39 -0300 Subject: [PATCH 1/3] fix: merge with remote games not updating local games correctly --- src/main/services/library-sync/merge-with-remote-games.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/services/library-sync/merge-with-remote-games.ts b/src/main/services/library-sync/merge-with-remote-games.ts index e31310fc..8790318f 100644 --- a/src/main/services/library-sync/merge-with-remote-games.ts +++ b/src/main/services/library-sync/merge-with-remote-games.ts @@ -32,10 +32,12 @@ export const mergeWithRemoteGames = async () => { { objectID: game.objectId, shop: "steam", + }, + { + remoteId: game.id, lastTimePlayed: updatedLastTimePlayed, playTimeInMilliseconds: updatedPlayTime, - }, - { remoteId: game.id } + } ); } else { const steamGame = await steamGamesWorker.run(Number(game.objectId), { From b60d9aa4dbfeb05fdcf5aa136096fc0c5b36b562 Mon Sep 17 00:00:00 2001 From: JackEnx Date: Thu, 20 Jun 2024 09:11:17 -0300 Subject: [PATCH 2/3] fix: memory usage --- src/main/workers/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/workers/index.ts b/src/main/workers/index.ts index cbcedaff..b0f9721f 100644 --- a/src/main/workers/index.ts +++ b/src/main/workers/index.ts @@ -11,6 +11,7 @@ export const steamGamesWorker = new Piscina({ workerData: { steamGamesPath: path.join(seedsPath, "steam-games.json"), }, + maxThreads: 1, }); export const downloadSourceWorker = new Piscina({ From 6b6b4723156e1ffeda94f5f2c23150e3005e4fa4 Mon Sep 17 00:00:00 2001 From: Zamitto <167933696+zamitto@users.noreply.github.com> Date: Thu, 20 Jun 2024 10:38:42 -0300 Subject: [PATCH 3/3] fix sending delta in millis to api --- src/main/services/library-sync/update-game-playtime.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/services/library-sync/update-game-playtime.ts b/src/main/services/library-sync/update-game-playtime.ts index efedf47c..190d7e7d 100644 --- a/src/main/services/library-sync/update-game-playtime.ts +++ b/src/main/services/library-sync/update-game-playtime.ts @@ -3,11 +3,11 @@ import { HydraApi } from "../hydra-api"; export const updateGamePlaytime = async ( game: Game, - delta: number, + deltaInMillis: number, lastTimePlayed: Date ) => { return HydraApi.put(`/games/${game.remoteId}`, { - playTimeDeltaInSeconds: Math.trunc(delta), + playTimeDeltaInSeconds: Math.trunc(deltaInMillis / 1000), lastTimePlayed, }); };