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), { 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, }); }; 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({