diff --git a/src/servers/sidecar/music/indexer.ts b/src/servers/sidecar/music/indexer.ts index ddc9fba3..9a2cb440 100644 --- a/src/servers/sidecar/music/indexer.ts +++ b/src/servers/sidecar/music/indexer.ts @@ -202,6 +202,7 @@ export function buildReport(s: IndexStatus = status): IndexReport { type ProgressListener = (s: IndexStatus) => void; const listeners = new Set(); let lastEmit = 0; +let lastLog = 0; export function onIndexProgress(cb: ProgressListener): () => void { listeners.add(cb); @@ -211,6 +212,15 @@ export function onIndexProgress(cb: ProgressListener): () => void { /** Notify subscribers of progress; throttled to ~200ms unless `force` (e.g. terminal 'done'). */ function emitProgress(force = false): void { const now = Date.now(); + // Console heartbeat (throttled to 3s, independent of the SSE cadence) so a long build shows life. + if (now - lastLog >= 3000) { + lastLog = now; + console.log( + `[music] … ${status.foldersScanned} folders · ${status.albumsBuilt} built/${status.albumsSkipped} skipped · ` + + `${status.tracksIndexed} tracks · ${status.videosIndexed} videos · ${status.postersSaved} posters · ` + + `${status.lyricsIndexed} lyrics — ${status.currentPath}`, + ); + } if (!force && now - lastEmit < 200) return; lastEmit = now; const snap = getIndexStatus();