From 577be4ea3440c258689a560d3d1a6c2ae158592b Mon Sep 17 00:00:00 2001 From: Fuwn Date: Fri, 5 Jun 2026 14:48:42 +0000 Subject: fix(airing): roll just-aired releases forward to stop refresh loop nextReleaseTime kept a just-aired release in the past for 5 minutes, showing a negative countdown and driving scheduleAiringRefresh into a 1-second revalidate loop. Always roll a past release to its next occurrence, and only arm the refresh timer on future airings. --- src/lib/Media/Anime/Airing/match.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/lib/Media/Anime/Airing/match.ts') diff --git a/src/lib/Media/Anime/Airing/match.ts b/src/lib/Media/Anime/Airing/match.ts index 9cfe6102..1994b300 100644 --- a/src/lib/Media/Anime/Airing/match.ts +++ b/src/lib/Media/Anime/Airing/match.ts @@ -144,7 +144,9 @@ const findScheduleEntry = ( // Resolve the next future release time for a matched entry. AnimeSchedule gives // the current week's episode; a delay window or a weekly cadence rolls a past -// release forward to the next occurrence. +// release forward to the next occurrence. This must never return a past time — +// a stuck-in-the-past airingAt produces a negative countdown and a tight +// refresh loop (see scheduleAiringRefresh). const nextReleaseTime = ( entry: AiringEntry, nowEpochSeconds: number, @@ -155,7 +157,7 @@ const nextReleaseTime = ( const base = entry.airingAt; if (!base) return 0; - if (base > nowEpochSeconds - STALE_AIRING_GRACE_SECONDS) return base; + if (base > nowEpochSeconds) return base; const weeksElapsed = Math.ceil((nowEpochSeconds - base) / SEVEN_DAYS_SECONDS); -- cgit v1.2.3