fix: treat title as "unreleased" if title is too far away to schedule

This commit is contained in:
2024-11-14 07:39:33 -05:00
parent ce82ae8990
commit d6a27e1fa4

View File

@@ -1,4 +1,5 @@
import type { HonoRequest } from "hono";
import { DateTime } from "luxon";
import {
addUnreleasedTitle,
@@ -21,7 +22,10 @@ export async function maybeScheduleNextAiringEpisode(
}
const { nextAiring, status } = await getNextEpisodeTimeUntilAiring(aniListId);
if (!nextAiring) {
if (
!nextAiring ||
DateTime.fromSeconds(nextAiring.airingAt).diffNow("hours").hours >= 720
) {
if (status === "NOT_YET_RELEASED") {
await addUnreleasedTitle(env, aniListId);
}