From 577be4ea3440c258689a560d3d1a6c2ae158592b Mon Sep 17 00:00:00 2001
From: Fuwn <contact@fuwn.net>
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/List/Anime/CleanAnimeList.svelte | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

(limited to 'src/lib/List/Anime/CleanAnimeList.svelte')

diff --git a/src/lib/List/Anime/CleanAnimeList.svelte b/src/lib/List/Anime/CleanAnimeList.svelte
index f2077d20..3fd43244 100644
--- a/src/lib/List/Anime/CleanAnimeList.svelte
+++ b/src/lib/List/Anime/CleanAnimeList.svelte
@@ -157,6 +157,7 @@ const scheduleAiringRefresh = () => {
 		return;
 	}
 
+	const now = Date.now() / 1000;
 	const nextAiringAt = media.reduce<number | null>((closest, currentMedia) => {
 		if (
 			currentMedia.status !== "RELEASING" &&
@@ -166,7 +167,9 @@ const scheduleAiringRefresh = () => {
 
 		const airingAt = currentMedia.nextAiringEpisode?.airingAt;
 
-		if (!airingAt) return closest;
+		// Only arm the timer for upcoming airings; a past airingAt would clamp the
+		// timeout to 1s and revalidate every second.
+		if (!airingAt || airingAt <= now) return closest;
 		if (closest === null) return airingAt;
 
 		return airingAt < closest ? airingAt : closest;
-- 
cgit v1.2.3

