chore: add debug logging to help understand why episode updates won't run

This commit is contained in:
2025-12-18 08:50:53 -05:00
parent 37b4f0bf2b
commit f9ca949d8e
2 changed files with 3 additions and 0 deletions

View File

@@ -82,6 +82,7 @@ export default {
case "ANILIST_UPDATES":
const anilistUpdateBody =
message.body as QueueBody["ANILIST_UPDATES"];
console.log("queue run", message.body);
switch (anilistUpdateBody.updateType) {
case AnilistUpdateType.UpdateWatchStatus:
if (!anilistUpdateBody[AnilistUpdateType.UpdateWatchStatus]) {

View File

@@ -276,12 +276,14 @@ export class AnilistDurableObject extends DurableObject {
const result = await fetcher();
await this.state.storage.put(key, result);
console.debug(`Retrieved alarms from cache:`, Object.entries(alarms));
const calculatedTtl = typeof ttl === "function" ? ttl(result) : ttl;
if (calculatedTtl && calculatedTtl > 0) {
const alarmTime = Date.now() + calculatedTtl;
await this.state.storage.setAlarm(alarmTime);
console.debug(`Deleting storage key ${storageKey} & alarm ${key}`);
await this.state.storage.put(`alarm:${key}`, alarmTime);
}