chore: add debug logging to help understand why episode updates won't run
This commit is contained in:
@@ -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]) {
|
||||||
|
|||||||
@@ -291,11 +291,13 @@ export class AnilistDurableObject extends DurableObject {
|
|||||||
async alarm() {
|
async alarm() {
|
||||||
const now = Date.now();
|
const now = Date.now();
|
||||||
const alarms = await this.state.storage.list({ prefix: "alarm:" });
|
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)) {
|
for (const [key, ttl] of Object.entries(alarms)) {
|
||||||
if (now >= ttl) {
|
if (now >= ttl) {
|
||||||
// The key in alarms is `alarm:${storageKey}`
|
// The key in alarms is `alarm:${storageKey}`
|
||||||
// We want to delete the storageKey
|
// We want to delete the storageKey
|
||||||
const storageKey = key.replace("alarm:", "");
|
const storageKey = key.replace("alarm:", "");
|
||||||
|
console.debug(`Deleting storage key ${storageKey} & alarm ${key}`);
|
||||||
await this.state.storage.delete(storageKey);
|
await this.state.storage.delete(storageKey);
|
||||||
await this.state.storage.delete(key);
|
await this.state.storage.delete(key);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user