Merge pull request #154 from hydralauncher/feat/format-playtime-in-hours

Feat/format playtime in hours
This commit is contained in:
Hydra
2024-05-03 19:37:20 +01:00
committed by GitHub
8 changed files with 45 additions and 24 deletions

View File

@@ -8,20 +8,18 @@ import { WindowManager } from "./window-manager";
const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));
export const startProcessWatcher = async () => {
const sleepTime = 300;
const sleepTime = 500;
const gamesPlaytime = new Map<number, number>();
// eslint-disable-next-line no-constant-condition
while (true) {
await sleep(sleepTime);
const games = await gameRepository.find({
where: {
executablePath: Not(IsNull()),
},
});
if (games.length == 0) {
if (games.length === 0) {
continue;
}
@@ -71,5 +69,7 @@ export const startProcessWatcher = async () => {
}
}
}
await sleep(sleepTime);
}
};