From caa85fa7eb26e3a6ebc700d1402c0a59f81747a4 Mon Sep 17 00:00:00 2001 From: shay <43248357+shayypy@users.noreply.github.com> Date: Sat, 23 Nov 2024 15:54:50 -0600 Subject: [PATCH] chore(bot): shorter notif DO timeout --- packages/bot/src/notifications.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/bot/src/notifications.ts b/packages/bot/src/notifications.ts index 808a77f..ea5abf3 100644 --- a/packages/bot/src/notifications.ts +++ b/packages/bot/src/notifications.ts @@ -1628,12 +1628,14 @@ export class DurableNotificationManager implements DurableObject { // We've probably been in a loop for several hours; schedule a purge. nextAlarm = null; } + // 3 minutes nextAlarm = new Date(now.getTime() + 180_000); } if (nextAlarm === null) { // The games are all over await this.state.storage.put("alarmType", AlarmType.Purge); - await this.state.storage.setAlarm(now.getTime() + 604_800_000); + // 2 days + await this.state.storage.setAlarm(now.getTime() + 86400 * 2); } else { // Wait at least 30 seconds before letting the next alarm happen const minimumAlarm = now.getTime() + 30_000; @@ -1644,7 +1646,7 @@ export class DurableNotificationManager implements DurableObject { break; } case AlarmType.Purge: { - // Executed 1 week after the game ends + // Executed 2 days after the last game ends // We don't need to clean up KV because the keys have TTLs await this.state.storage.deleteAll(); return;