perf: remove 3 high-volume console.log calls in download / update paths

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) <noreply@anthropic.com>
This commit is contained in:
xRangerDE 2026-05-11 05:09:29 +02:00
parent a46984d8ab
commit 7e7be1d103

View File

@ -3293,7 +3293,8 @@ function downloadVODPart(
args.push('--hls-duration', endTime); 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 }); appendDebugLog('download-part-start', { itemId, command: streamlinkCmd.command, filename, args });
const proc = spawn(streamlinkCmd.command, args, { windowsHide: true }); const proc = spawn(streamlinkCmd.command, args, { windowsHide: true });
@ -3360,7 +3361,11 @@ function downloadVODPart(
proc.stdout?.on('data', (data: Buffer) => { proc.stdout?.on('data', (data: Buffer) => {
const line = data.toString(); 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 // Parse progress
const match = line.match(/(\d+\.\d+)%/); const match = line.match(/(\d+\.\d+)%/);
@ -6440,7 +6445,9 @@ function setupAutoUpdater() {
}); });
autoUpdater.on('download-progress', (progress) => { 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) { if (mainWindow) {
mainWindow.webContents.send('update-download-progress', { mainWindow.webContents.send('update-download-progress', {
percent: progress.percent, percent: progress.percent,