fix: treat title as "unreleased" if title is too far away to schedule
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
import type { HonoRequest } from "hono";
|
import type { HonoRequest } from "hono";
|
||||||
|
import { DateTime } from "luxon";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
addUnreleasedTitle,
|
addUnreleasedTitle,
|
||||||
@@ -21,7 +22,10 @@ export async function maybeScheduleNextAiringEpisode(
|
|||||||
}
|
}
|
||||||
|
|
||||||
const { nextAiring, status } = await getNextEpisodeTimeUntilAiring(aniListId);
|
const { nextAiring, status } = await getNextEpisodeTimeUntilAiring(aniListId);
|
||||||
if (!nextAiring) {
|
if (
|
||||||
|
!nextAiring ||
|
||||||
|
DateTime.fromSeconds(nextAiring.airingAt).diffNow("hours").hours >= 720
|
||||||
|
) {
|
||||||
if (status === "NOT_YET_RELEASED") {
|
if (status === "NOT_YET_RELEASED") {
|
||||||
await addUnreleasedTitle(env, aniListId);
|
await addUnreleasedTitle(env, aniListId);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user