From 7e7be1d103dd0aa97ec0ae55eed63c74ddc516ff Mon Sep 17 00:00:00 2001 From: xRangerDE Date: Mon, 11 May 2026 05:09:29 +0200 Subject: [PATCH] perf: remove 3 high-volume console.log calls in download / update paths MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Three console.log calls in main.ts were flooding stdout during normal operation: 1) `console.log("Starting download:", cmd, args)` — redundant with the appendDebugLog("download-part-start", ...) one line below. Duplicate logging; pure noise. 2) `console.log("Streamlink:", line)` — fired for every line of streamlink stdout, which is 10-100 lines/sec during an active download. Hundreds of thousands of lines per multi-hour recording. Progress + state parsing already happens on the same line; the raw output was never consumed. 3) `console.log("Download progress: X%")` in the autoUpdater handler — fires ~10x/sec during an in-flight update download. The renderer banner is the user-visible feedback; this was developer-only and never necessary in prod. Removed all three. The remaining four console.log calls (login flow, update-available, update-downloaded, no-updates-available) are once-per-event and fine to keep. Practical benefit: stdout becomes useful for actual diagnostics again. Performance gain is marginal in absolute terms but the buffered noise on a long-running session was real. Co-Authored-By: Claude Opus 4.7 (1M context) --- src/main.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/main.ts b/src/main.ts index 9d2ecc5..35d3a4d 100644 --- a/src/main.ts +++ b/src/main.ts @@ -3293,7 +3293,8 @@ function downloadVODPart( args.push('--hls-duration', endTime); } - console.log('Starting download:', streamlinkCmd.command, args); + // download-part-start in the debug log captures the same info + // for support / forensics — no need to flood stdout too. appendDebugLog('download-part-start', { itemId, command: streamlinkCmd.command, filename, args }); const proc = spawn(streamlinkCmd.command, args, { windowsHide: true }); @@ -3360,7 +3361,11 @@ function downloadVODPart( proc.stdout?.on('data', (data: Buffer) => { const line = data.toString(); - console.log('Streamlink:', line); + // No per-line stdout — streamlink emits 10-100 lines/sec during + // an active download, which floods the terminal in dev and the + // electron-launched console in prod. Progress + tag parsing + // below extracts everything we need; failures get logged via + // appendDebugLog from the consumer side. // Parse progress const match = line.match(/(\d+\.\d+)%/); @@ -6440,7 +6445,9 @@ function setupAutoUpdater() { }); autoUpdater.on('download-progress', (progress) => { - console.log(`Download progress: ${progress.percent.toFixed(1)}%`); + // No per-tick stdout — the autoUpdater fires this ~10x/sec during + // an in-flight download. The renderer banner is the user-visible + // surface; appendDebugLog already captures phase transitions. if (mainWindow) { mainWindow.webContents.send('update-download-progress', { percent: progress.percent,