From cb82424eb2420ae55c675b983263d87411f7da6e Mon Sep 17 00:00:00 2001 From: Zamitto Date: Tue, 23 Apr 2024 22:21:07 -0300 Subject: [PATCH] correctly print time logs --- src/main/services/process-watcher.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/main/services/process-watcher.ts b/src/main/services/process-watcher.ts index 2ed46cd0..c040373a 100644 --- a/src/main/services/process-watcher.ts +++ b/src/main/services/process-watcher.ts @@ -15,7 +15,7 @@ export const startProcessWatcher = async () => { while (true) { await sleep(sleepTime); - console.log("loopTotalTime"); + console.time("loopTotalTime"); const games = await gameRepository.find({ where: { executablePath: Not(IsNull()), @@ -66,16 +66,13 @@ export const startProcessWatcher = async () => { } gamesPlaytime.set(game.id, performance.now()); - - continue; - } - - if (gamesPlaytime.has(game.id)) { + } else if (gamesPlaytime.has(game.id)) { gamesPlaytime.delete(game.id); if (WindowManager.mainWindow) { WindowManager.mainWindow.webContents.send("on-game-close", game.id); } } } + console.timeEnd("loopTotalTime"); } };