aboutsummaryrefslogtreecommitdiff
path: root/src/lib/Media/Anime/Airing/match.ts
diff options
context:
space:
mode:
authorFuwn <[email protected]>2026-06-05 14:48:42 +0000
committerFuwn <[email protected]>2026-06-05 14:48:42 +0000
commit577be4ea3440c258689a560d3d1a6c2ae158592b (patch)
tree763f658f5d785d64be43e2432052ec18e1e45f8f /src/lib/Media/Anime/Airing/match.ts
parentfeat(schedule): add native track alongside sub and dub (diff)
downloaddue.moe-main.tar.xz
due.moe-main.zip
fix(airing): roll just-aired releases forward to stop refresh loopHEADmain
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.
Diffstat (limited to 'src/lib/Media/Anime/Airing/match.ts')
-rw-r--r--src/lib/Media/Anime/Airing/match.ts6
1 files changed, 4 insertions, 2 deletions
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);