fix(main): R9 — guard the yt-dlp update throttle against a backward clock
shouldAutoCheckYtdlp compared (now - lastCheck) >= interval; a backward system- clock correction leaves lastCheck in the future so the difference is negative and the daily check never comes due again. Treat a future lastCheck as skewed and run the check. The renderer scheduled-item promoter is inherently fire-once (promotion flips the item out of 'saved'), so it can't double-fire on a backward jump — a forward jump firing early is documented and accepted as minor. Unit-tested. typecheck + 263 tests + eslint + prettier green. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -21,5 +21,10 @@ export function shouldAutoCheckYtdlp(
|
||||
): boolean {
|
||||
if (!enabled) return false
|
||||
if (!lastCheck) return true
|
||||
// A backward system-clock correction can leave `lastCheck` in the "future"
|
||||
// relative to `now`, making `now - lastCheck` negative so the daily check would
|
||||
// never come due again. Treat a future timestamp as skewed/bogus and run the
|
||||
// check rather than waiting out a negative interval (R9).
|
||||
if (lastCheck > now) return true
|
||||
return now - lastCheck >= intervalMs
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user