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 1958110679
commit 0cdfbd5c56
2 changed files with 3 additions and 0 deletions

View File

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

View File

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