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 45f6f678b6
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

@@ -291,11 +291,13 @@ export class AnilistDurableObject extends DurableObject {
async alarm() {
const now = Date.now();
const alarms = await this.state.storage.list({ prefix: "alarm:" });
console.debug(`Retrieved alarms from cache:`, Object.entries(alarms));
for (const [key, ttl] of Object.entries(alarms)) {
if (now >= ttl) {
// The key in alarms is `alarm:${storageKey}`
// We want to delete the storageKey
const storageKey = key.replace("alarm:", "");
console.debug(`Deleting storage key ${storageKey} & alarm ${key}`);
await this.state.storage.delete(storageKey);
await this.state.storage.delete(key);
}