diff --git a/src/services/readingPositionService.ts b/src/services/readingPositionService.ts index 52cd7393..a3383d7f 100644 --- a/src/services/readingPositionService.ts +++ b/src/services/readingPositionService.ts @@ -203,14 +203,10 @@ export function collectReadingPositionsOnce(params: { hasEmitted = true if (candidates.length === 0) { - console.log('[reading-position] 📊 No candidates collected during stabilization window') stableCallback(null) return } - console.log('[reading-position] 📊 Collected', candidates.length, 'position candidates:', - candidates.map(c => `${Math.round(c.position * 100)}% @${new Date(c.timestamp * 1000).toLocaleTimeString()}`).join(', ')) - // Sort: newest first, then highest progress candidates.sort((a, b) => { const timeDiff = b.timestamp - a.timestamp @@ -218,13 +214,10 @@ export function collectReadingPositionsOnce(params: { return b.position - a.position }) - console.log('[reading-position] ✅ Best position selected:', Math.round(candidates[0].position * 100) + '%', - 'from', new Date(candidates[0].timestamp * 1000).toLocaleTimeString()) stableCallback(candidates[0]) } // Start streaming and collecting - console.log('[reading-position] 🎯 Starting stabilized position collector (window:', windowMs, 'ms)') streamStop = startReadingPositionStream( relayPool, eventStore, @@ -233,21 +226,16 @@ export function collectReadingPositionsOnce(params: { (pos) => { if (hasEmitted) return if (!pos) { - console.log('[reading-position] 📥 Received null position') return } if (pos.position <= 0.05 || pos.position >= 1) { - console.log('[reading-position] 🚫 Ignoring position', Math.round(pos.position * 100) + '% (outside 5%-100% range)') return } - console.log('[reading-position] 📥 Received position candidate:', Math.round(pos.position * 100) + '%', - 'from', new Date(pos.timestamp * 1000).toLocaleTimeString()) candidates.push(pos) // Schedule one-shot emission if not already scheduled if (!timer) { - console.log('[reading-position] ⏰ Starting', windowMs, 'ms stabilization timer') timer = setTimeout(() => { emitStable() if (streamStop) streamStop()